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, 21.06.2019 19:30
Write a function processpeople() that takes the name of a file as a parameter. each line of the file corresponds to information about a person. in particular a line contains either a name (in the form lastname,firstname with no spaces in it) or a name (lastname,firstname) and a year. the function will process the file, creating a person object for each line in the file. the function will print information about each line as it processes it, as well as appending the new person object into a list. make sure to use person methods to display information rather than recreating the work you did for the first problem. once the entire file has been processed, the function returns the list of person objects created from the file. if the file is empty, the function should return an empty list. if the input file cannot be opened, the function should print a message to that effect and then return an empty list. the following shows what would be displayed for two example files which have been provided in the link. the file none.txt does not exist. note that your function must work on an arbitrary file that consists of valid lines. you cannot assume anything about the file except that it contains lines that have the format described above.
Answers: 2
question
Computers and Technology, 22.06.2019 04:30
What kind of software users of all skill levels create web pages that include graphics, video, audio, animation, and other special effects? website authoring website software website publishing website editing
Answers: 1
question
Computers and Technology, 22.06.2019 18:30
What is outfitting a workplace with video in a technology
Answers: 2
question
Computers and Technology, 22.06.2019 22:00
During physical science class ben and jerry connected three identical lightbulbs in parallel to a battery where happens when ben removes one of the lightbulbs from it’s socket
Answers: 2
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
Mathematics, 05.05.2020 01:47
question
Mathematics, 05.05.2020 01:47
question
Mathematics, 05.05.2020 01:47
question
Mathematics, 05.05.2020 01:47
question
Mathematics, 05.05.2020 01:47
Questions on the website: 13722362