Answer:
import random
scores = []
for i in range(8):
score = random.randint(0,100)
scores.append(score)
best_score = max(scores)
letter_grade = ""
for s in scores:
if s >= best_score - 10:
letter_grade = "A"
elif s >= best_score - 20:
letter_grade = "B"
elif s >= best_score - 30:
letter_grade = "C"
elif s >= best_score - 40:
letter_grade = "D"
else:
letter_grade = "F"
print(letter_grade)
Step-by-step explanation:
Import the random module
Create an empty list to hold the scores
Create a for loop that iterates 8 times. Inside the loop, create 8 random scores and put them in the scores
When the loop is done, find the best_score using max method
Create another for loop that iterates through the scores. Check each score and set the letter_grade depending on the given conditions.