Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Python:Design a program that asks the user to enter a series of 20 numbers. The

ID: 3818769 • Letter: P

Question

Python:Design a program that asks the user to enter a series of 20 numbers. The program should store the numbers in a list and then display the following data: The lowest number in the list, The highest number in the list, The total of the numbes in the list, The average of the numbers on the list.
**Your solution must be written with a main function and include the following two functions:


**get_values - value-returning function: accepts a number as an argument indicating the length of a list, gets user input for a list of numbers, and returns the list of numbers. The return type for this function must be a list . Use a for loop.

**do_analysis – void function: accepts a list of numbers as an argument, then calculates and displays the statistical data specified by the problem.

Explanation / Answer

Hi, you can create a code like this

Please make sure that indentation is correct

def main():
l=get_values(20)
do_analysis(l)
  
def get_values(n):
l=[]
for i in range(n):
temp=int(input("Please enter element number "+str(i+1)+": "))
l.append(temp);
return l

def do_analysis(l):
minn=999
maxx=-999
avg=0
count=0
for elem in l:
count+=1;
avg+=elem;
if(elem<minn):
minn=elem
if(elem>maxx):
maxx=elem
  
print("Minimum element is: "+str(minn))
print("Maximum element is: "+str(maxx))
print("Total of all elements is: "+str(avg))
print("Average of all elements is: "+str(avg/count))
  
  
main()

Output: (I have tested it for 5 elements)

Please enter element number 1: 12

Please enter element number 2: 21

Please enter element number 3: 1222

Please enter element number 4: 3

Please enter element number 5: -11
Minimum element is: -11
Maximum element is: 1222
Total of all elements is: 1247
Average of all elements is: 249.4