Ask Question
22 June, 03:57

Write a program that reads in exam scores and displays the average score and the high score You should first ask the user how many exams there are. Your program must work for any number of exams. How many exams? 5 Enter a score: 74 Enter a score: 91 Enter a score: 87 Enter a score: 93 Enter a score: 82 The average is 86.8, the high score is 93

+5
Answers (1)
  1. 22 June, 07:50
    0
    exams = []

    quantity = int (input ('How many exams? '))

    for i in range (quantity):

    exams. append (float (input ('Enter a score: ')))

    print ('Average score: ', sum (exams) / len (exams))

    print ('High score: ', max (exams))

    Explanation:

    Step 1 define variables

    exams = []

    Step 2 get the quantity of scores (user input)

    quantity = int (input ('How many exams? '))

    Step 3 loop over the quantity of exams and input the score and save it in an array

    for i in range (quantity):

    exams. append (float (input ('Enter a score: ')))

    Step 4 show the results

    print ('Average score: ', sum (exams) / len (exams))

    print ('High score: ', max (exams))

    Functions used:

    sum: get the summarize of the array

    len: get the quantity of elements in an array

    max: get the max value in an array
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write a program that reads in exam scores and displays the average score and the high score You should first ask the user how many exams ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers