subject

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.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 19:10
What a backup plan that you have created in a event you encounter a situation
Answers: 2
question
Computers and Technology, 22.06.2019 23:50
List a few alternative options and input and output over the standerd keyboard and monitor. explain their functioning in details.
Answers: 2
question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. sean is a computer programmer. he has programmed an application for toddlers that plays nursery rhymes. however, a logic error has occurred in the program. which problem is a likely consequence of the error? a. the program crashes every time the user wants to play the nursery rhymes. b. the program crosses its buffer boundaries and overwrites an adjacent program. c. the program plays a different nursery rhyme than the one the user intended to play. d. the program shows different structures in its programming language code. e. the program introduces new viruses every time the user plays a nursery rhyme.
Answers: 1
question
Computers and Technology, 23.06.2019 15:30
1. ask the user how many questions are in the quiz. 2. ask the user to enter the key (that is, the correct answers). there should be one answer for each question in the quiz, and each answer should be an integer. e.g., 34 7 13 100 81 3 9 10 321 12 might be the key for a 10-question quiz. you will need to store the key in an array. 3. ask the user to enter the answers for the quiz to be graded. there needs to be one answer for each question. note that these answers do not need to be stored; each answer can simply be compared to the key as it is entered. 4. when the user has entered all of the answers to be graded, print the number correct and the percent correct. 5. add a loop so that the user can grade any number of quizzes with a single key. after the results have been printed for each quiz, ask "grade another quiz? (y/n)." note: you only have one array (the key). you are not creating a new key for each set of quiz answers.
Answers: 3
You know the right answer?
Write a Python 3 program that prompts the user for 3 postive numbers (or zero) and then adds them to...
Questions
question
English, 01.06.2021 05:10
question
Mathematics, 01.06.2021 05:20
question
World Languages, 01.06.2021 05:20
question
Mathematics, 01.06.2021 05:20
Questions on the website: 13722361