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]
2 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]2 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
The mac group does not replace the primary functions of eocs or other dispatch organizations. True or False
Oxana [17]

Answer:

TRUE

Explanation:

MAC - multi-agency coordination is a group of executives or administrators that have the authority to control agency funds or resources while EOCs -  Emergency operation centers are in charge of carrying out of emergency tasks that requires preparedness or disasters, they ensure that work continues even in case of emergency and disasters.

7 0
3 years ago
Which of the following statements holds true for the term "html"? It refers to a system that connects end users to the Internet.
Oksana_A [137]

Answer:

Your answer is B. It refers to the language used to create and format Web pages.

Explanation:

HTML stands for "Hyper Text Markup Language", which is a specification used on any webpage, ever. It was created by Sir Tim Berners-Lee in late 1991 and was officially released in 1995. This language is actually what is sent to your browser, which then interprets it and allows you to see the pretty pictures of Brainly.com! As of right now, HTML is at it's 5th revision, also known as HTML5, which is another term you'll see around.

Thanks, let me know if this helped!

3 0
3 years ago
Read 2 more answers
In order to be compliant with the NIST publications, policies must include key security control requirements. One of these key r
lesya692 [45]

Answer:

True

Explanation:

In order to be compliant with the NIST publications, policies must include key security control requirements. One of these key requirements includes certification and accreditation, which is a process that occurs after the system is documented, controls tested, and risk assessment completed. It is required before going live with a major system. Once a system is certified and accredited, responsibility shifts to the owner to operate the system is a true statement.

8 0
3 years ago
What are the real-life applications of coding?
oksian1 [2.3K]

Some example's of coding affecting real life:

  • Traffic Lights
  • Biometric Security
  • Robots used in factories. can work in extreme conditions.
  • Automatic Heater or Air Conditioner.
  • Expert Systems used in for Medical Use.
  • Smart Self Driving Cars
8 0
1 year ago
Suppose the m2 money supply is $13 trillion, including: $7 trillion in savings accounts $3 trillion in checking accounts $1 tril
tia_tia [17]

Answer:

M1 is equal to $ 4 trillion

Explanation:

M1 money supplies are liquid money supplies like cash, checkable deposits, traveler's check etc. It is equal to;

M1= coins and currency in circulation + checkable (demand) deposit + traveler's check.

M2 money supply are less liquid and is equated as;

M2 = M1 + savings deposit + money market fund + certificates of deposit + other time deposits.

Savings = $7 trillion

Checkable deposit = $3 trillion

Money market fund = $1 trillion

Currency = $1 trillion

Certificates of deposit = $1 trillion

M1 = currency + checkable deposit

= $1 + $ 3

= $4 trillion.

6 0
2 years ago
Other questions:
  • explain the key reasons why entity relationship modeling is important, and determine at least (1) way in which it impacts the ov
    5·1 answer
  • Checking the ___________ will reduce the possibility of having to rebuild or replace the engine.
    9·2 answers
  • Pascal's Triangle is a triangular array in which every number represents the
    15·1 answer
  • Given a double variable named areaofsquare write the necessary code to read in a value , the area of some square, into areaofsqu
    9·1 answer
  • ABC software company is to develop software for effective counseling for allotment of engineering seats for students with high s
    13·1 answer
  • One gigabyte can be expressed as: a.) 1,000 kilobytes b.) 1,000 bytes c.) 80,000 kilobytes d.) 1,000 megabytes e.) 8,000 bits
    5·1 answer
  • Consider a channel that can lose packets but has a maximum delay that is known. Modify Protocol rdt2.1 to include sender timeout
    11·1 answer
  • A sequence of one or more characters is called
    14·1 answer
  • What should be used to keep a tablet dry?
    13·1 answer
  • Need help ASAP.<br> I am so lost.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!