Question: 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
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:
lowest number in list, highest number in list, total of numbers in list, average of numbers in list.
The following is what I have for the program. I keep getting an error message that "print" is an invalid syntax. If this is corrected, is the rest of the program written correctly?
#main def main():
#create empty list twenty_number_list = []
#loop variable another = 'Y'
#prompt user for numbers and add to list while another == 'Y': value = float(input('Enter a number: ')) twenty_number_list.append(value)
#prompt user for another number print('Do you want to add another number?') another = input('Y = yes, anything else = no: ')
#initialize variable with first element of array min_value=twenty_number_list[0] max_value=twenty_number_list[0]
#set total to zero total=0
#calculate total using for loop and average for i in range(20): total+=int(twenty_number_list[i] #printing data print('The lowest number is: '+str(min_value)) print('The highest number is: '+str(max_value)) print('The total value is: '+str(total)) print('The average value is: '+str(average))
#calling main main()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
