1answer.
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
lesantik [10]
3 years ago
12

Write a Python 3 program that prompts the user for 3 postive numbers (or zero) and then adds them together. If the user enters a

negative number, the program should reprompt them until they enter a postive number. Divide your program into two functions: prompt_number - Prompts for a number, and keeps re-prompting as long as it is negative. Then, returns the number. compute_sum - Accepts 3 numbers, adds them together and returns the sum. main - Calls the prompt_number function 3 times, saves the return value into three different variables, then passes those 3 variables to the compute_sum function. Finally, saves the result of compute_sum into a variable and displays it.
Computers and Technology
1 answer:
Citrus2011 [14]3 years ago
6 0

Answer:

def prompt_number():

   while True:

       number = int(input("Enter a number: "))

       if number >= 0:

           break

       

   return number

   

def compute_sum(n1, n2, n3):

   total = n1 + n2 + n3

   return total

   

n1 = prompt_number()

n2 = prompt_number()

n3 = prompt_number()

result = compute_sum(n1, n2, n3)

print(result)

Explanation:

Create a function named prompt_number that asks the user to enter a number until a positive number or 0 is entered and returns the number

Create a function named compute_sum that takes three numbers, sums them and returns the sum

Ask the user to enter three numbers, call the prompt_number() three times and assign the values

Calculate the the sum, call the compute_sum and pass the numbers as parameters

Print the result

You might be interested in
George works for a print newspaper in which of these areas would you be interested to hire new recruits for the newspaper WHICH
Stolb23 [73]

Answer:

number 4

Explanation:

3 0
3 years ago
What will be the results of executing the following statements? x.setEditable(true); x.setText("Tiny Tim"); a. The text field x
maxonik [38]

Answer:

Option B: The text field x will have the value "Tiny Tim" and the user will be able to change its value.

Explanation:

  • The first statement say:  x.setEditable(true);

It will only change the property of the text present in x to editable. This means that whenever the text value needs to change the user can edit it.

  • The second statement say:   x.setText("Tiny Tim");

It will put the text "Tiny Tim" into the attribute x and present it as the output or result.

6 0
3 years ago
Cell references in a formula are called _____.<br> a. assumptionsc. numbersb. valuesd. content
Airida [17]
It would bbe d because content is what is in something
7 0
3 years ago
The trademarked name of the accepted standard for configuring wireless networks is _______________
enyata [817]

Answer:

WiFi

Explanation:

WiFi is a standard wireless network configuration developed by IEEE (Institute of Electrical and Electronics Engineers) as a 802.11 standard.

WiFi is embedded in chips in computers and configured for finding wireless routers. WiFi certified points can identify each other, this standardized networks are available almost all online electronic devices.  

Wi-Fi Alliance is the authority to certify devices which satisfy the IEEE 802.11 standards.

3 0
3 years ago
Case 1-1Tom has just started working as an intern for a local radio station. He is responsible for managing the request line and
pantera1 [17]

Answer:

The answer is Live Preview.

Explanation:

<em>Live Preview is a Powerpoint tool that helps the user to find out how a singular choice will change the appearance of the presentation, without committing any change. This application allows the user to edit any slide and see the changes without any risk of damaging the rest of the presentation.</em>

<em>It lets the user see how an actual change will look on the slide  object before the user decides to accept or decline the change.</em>

<em>It is a powerful resource, because we know how handful it is to prepare a powerpoint presentation.</em>

3 0
3 years ago
Other questions:
  • The purpose of the ________ element is to describe the contents of a table.
    15·1 answer
  • The ____ preceding a formula alerts excel that you are entering a formula or function and not text
    14·1 answer
  • Name three recent advances that are influencing OS design.
    15·1 answer
  • which three objects can be linked or embedded in a word document? A. worksheets, margins, colors B. charts, worksheets, images C
    7·1 answer
  • To implement a small database, a database designer must know the "1" and the "M" sides of each relationship and whether the rela
    7·1 answer
  • When you touch a hot stove, along which pathway will the impulses travel and what is the final destination in the cns?
    12·1 answer
  • What is the biggest challenge for most business when going online?
    12·1 answer
  • 2. Used to drive in or remove screws that fasten electrical wires or other electrical accessories. A. Pliers C. Screwdrivers B.
    15·1 answer
  • Discuss the advantages and disadvantages of supporting links to files that cross mount points (that is, the file link refers to
    6·1 answer
  • Which of the following offers more reliable antivirus protection? Question 43 options: A) antivirus software on user PCs B) anti
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!