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

Respuesta :

Answer:

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

ACCESS MORE