answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Juli2301
29 days ago
15

Write a statement that assigns finalResult with the sum of num1 and num2, divided by 3. Ex: If num1 is 4 and num2 is 5, finalRes

ult is 3.
Computers and Technology
1 answer:
Natasha_Volkova [897]29 days ago
6 0

Answer:

To be executed in Python 3:

num1 = int(input("Enter first value: "))

num2 = int(input("Enter second value: "))

finalResult =(num1+num2) / 3

print("Result is: ", finalResult)

INPUT:

Enter first value: 4

Enter second value: 5

OUTPUT:

Result is: 3

Explanation:

The initial step involves defining the variables:

  • num1 and num2

Next, we prompt for an input:

  • input("Enter first value: ")

Then, these inputs need to be converted into integers by placing the above line within int(). This step is essential to perform any calculations with the acquired values.

  • num1 = int(input("Enter first value: "))

The subsequent step is to compute:

  • finalResult =(num1+num2) / 3
  • Initially, we sum the values of num1 and num2, and then divide that sum by 3.

To verify whether the output is correct, we print it:

  • print("Result is: ", finalResult)
  • When using print() for strings, it requires quotation marks, such as: "text here"
  • However, when printing variables and numbers (which include integers, floats, etc.), there is no need for quotation marks.
  • To combine a string and an integer (in this case, the variable finalResult), simply place a comma after the string.

You might be interested in
Would two bits be enough to assign a unique binary number to each vowel in the English language? Explain.
Harlamova29_29 [932]

Response:

No.

Clarification:

Since there are 5 vowels, at least 3 bits are necessary to represent them all. Utilizing 2 bits yields 2²=4 combinations, which isn’t enough. However, using 3 bits provides 2³=8 combinations, sufficiently covering the 5 vowels.

3 0
1 month ago
Kirk found a local community college with a two-year program and he is comparing the cost with that of an out-of-state two-year
maria [879]

What is the anticipated overall expense for one year at the local community college should Kirk reside at home?

Answer: $6845



What is the estimated total cost for one year at the out-of-state institution if Kirk resides on campus?

Answer: $30,566

5 0
28 days ago
Read 2 more answers
Which of the following statements is incorrect? An operating system provides an environment for the execution of programs. An op
ivann1987 [930]

Response:

command line and graphical user interface

Clarification:

There have historically been (and continue to be) operating systems lacking any graphical user interface at all, such as some Unix variants.

]} ```json `{
8 0
1 month ago
A half-life is the amount of time it takes for a substance or entity to fall to half its original value. Caffeine has a half-lif
8_murik_8 [892]

Answer:

// C++ program.

#include <bits/stdc++.h>

using namespace std;

// main function

int main() {

  // variable

float n;  

cout<<"Enter the initial value:";

//User input

cin>>n;

//Variables for measurements at 6, 12, and 18 hours

float hours_6, hours_12, hours_18;  

//Set floating-point precision

cout << fixed;

    cout << setprecision(6);

 //Calculate caffeine amounts after 6, 12, 18 hours

hours_6 = n / 2.0;

hours_12 = hours_6 / 2.0;

hours_18 = hours_12 / 2.0;

//Display results

cout<<"After 6 hours: "<<hours_6<<"mg"<<endl;

cout<<"After 12 hours: "<<hours_12<<"mg"<<endl;

cout<<"After 18 hours: "<<hours_18<<" mg"<<endl;

return 0;

}

Explanation:

The program reads input from the user and sets the output precision to six decimal places. The caffeine amount after 6 hours is half the initial input. At 12 hours, it is half the 6-hour value, and after 18 hours, it is half the 12-hour value.

Output:

Enter the initial value:100

After 6 hours: 50.000000 mg

After 12 hours: 25.000000 mg

After 18 hours: 12.500000 mg

5 0
1 month ago
How to write a program that prompts the user to input two POSITIVE numbers — a dividend (numerator) and a divisor (denominator).
Rzqust [894]

Answer:

num1 = int(input("Numerator: "))

num2 = int(input("Denominator: "))

if num1 < 1 or num2<1:

     print("Input must be greater than 1")

else:

     print("Quotient: "+str(num1//num2))

     print("Remainder: "+str(num1%num2))

Explanation

The next two lines prompt the user for two numbers

num1 = int(input("Numerator: "))

num2 = int(input("Denominator: "))

The next if statement checks whether either or both inputs are not positive

if num1 < 1 or num2<1:

     print("Input must be greater than 1")-> If true, this print statement will run

If the conditions are not met, the program prints the quotient and remainder

else:

     print("Quotient: "+str(num1//num2))

     print("Remainder: "+str(num1%num2))

3 0
25 days ago
Other questions:
  • A computer can successfully ping outside the local network, but cannot access any world wide web services. what is the most prob
    5·1 answer
  • 6. Write pseudo code that will perform the following. a) Read in 5 separate numbers. b) Calculate the average of the five number
    6·1 answer
  • How to code 2.9.5: Four colored triangles {Code HS}
    10·1 answer
  • 1. Orthographic Drawings are used to express ideas that are more complicated. Explain the purpose of the different views and the
    7·1 answer
  • CHALLENGE ACTIVITY 2.1.2: Assigning a sum. Write a statement that assigns total_coins with the sum of nickel_count and dime_coun
    11·1 answer
  • Write the definition of a function power_to, which receives two parameters. The first is a float and the second is an integer. T
    5·1 answer
  • Assume that you are testing the Orders database introduced in Watt (2014) - Appendix C. Discuss the problems and possible conseq
    12·1 answer
  • Write an expression that will cause the following code to print "18 or less" if the value of user_age is 18 or less. Write only
    9·2 answers
  • A wireless network does not benefit like a wired network does, when it comes to collision reduction. Which device reduces collis
    6·1 answer
  • Write a method, isEmailAddress, that is passed a String argument. It returns true or false depending on whether the argument has
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!