Ask Question
23 July, 07:18

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

+2
Answers (1)
  1. 23 July, 09:43
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers