Ask 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 display the following dа ta: • The lowest number in the list • The highest number in the list • The total of the numbers in the list • The average of the numbers in the list

+2
Answers (1)
  1. 11 August, 19:54
    0
    The following are the program in the Python Programming Language.

    #declare the list

    lst=[]

    #set the for loop

    for num in range (1,21):

    #get the element of the list from the user

    n=int (input ('Enter the {} element : '. format (num)))

    #add elements in the list

    lst. append (n)

    print ()

    #print the minimum number in list

    print ('The lowest number in the list: ', min (lst))

    #print the maximum number in list

    print ('The highest number in the list: ', max (lst))

    #print the total of the list

    print ('The total of the numbers in the list: ', sum (lst))

    #print the average of the list

    print ('The average of the numbers in the list: ', sum (lst) / len (lst))

    Output:

    Enter the 1 element : 53

    Enter the 2 element : 65

    Enter the 3 element : 41

    Enter the 4 element : 23

    Enter the 5 element : 21

    Enter the 6 element : 12

    Enter the 7 element : 96

    Enter the 8 element : 85

    Enter the 9 element : 74

    Enter the 10 element : 98

    Enter the 11 element : 75

    Enter the 12 element : 41

    Enter the 13 element : 54

    Enter the 14 element : 56

    Enter the 15 element : 36

    Enter the 16 element : 25

    Enter the 17 element : 14

    Enter the 18 element : 12

    Enter the 19 element : 45

    Enter the 20 element : 65

    The lowest number in the list: 12

    The highest number in the list: 98

    The total of the numbers in the list: 991

    The average of the numbers in the list: 49.55

    Explanation:

    The following are the description of the program.

    Firstly, we declare the empty list type variable 'lst' to store elements. Then, set the for loop statement that iterates from 1 and end at 20. Then, set a variable that get elements of the list from the user and appends those user defined inputs in the list type variable 'lst'. Finally, print the lowest and the largest elements in the list as well as print the total and average of the elements in the list.
Know the Answer?
Not Sure About the Answer?
Find an answer to your 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 display the ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers