THON PROGRAMMING ONLY PLZZ Ask the user to enter numbers: You must have a way for the user to stop entering numbers. An example would be to have the user type q. Store the numbers the user entered into a list Calculate the total Calculate the average Calculate the largest number Display the following information to the user: How many numbers the user entered The total The average The largest number Print each value with a descriptio
PYTHON
Ask the user to enter numbers:
You must have a way for the user to stop entering numbers. An example would be to have the user type q.
- Store the numbers the user entered into a list
- Calculate the total
- Calculate the average
- Calculate the largest number
Display the following information to the user:
- How many numbers the user entered
- The total
- The average
- The largest number
Print each value with a description do not just print numbers to the console. Describe each number as they print.
Program Approach:
1- As mentioned in the assignment make the program user option like "do you want to continue y/q".
2- If the user enters y then the program flow will continue.
3- If the user enters q then the program will break immediately.
4- Define the empty list as number_list = []
5- Prompt a message to take the list size from a user.
6- As per list size loop will iterate and append the number into the list.
7- sum function use to calculate the total number of a list item.
8- len function is used to find the total number of list sizes.
9- Now, the total number of lists and divided by list size to calculate the average.
10- Please check the following complete example and output screenshot.
Step by step
Solved in 3 steps with 1 images