Question: HERE IS MY CODE SO FAR: stud = int(input(Enter the number of students: )) scores = input(fEnter {stud} scores: ) scores = [int(score) for score

HERE IS MY CODE SO FAR:
stud = int(input("Enter the number of students: ")) scores = input(f"Enter {stud} scores: ") scores = [int(score) for score in scores.split()] best_score = max(scores)
for i in range(stud): if scores[i] >= best_score - 10: grade = "A" elif scores[i] >= best_score - 20: grade = "B" elif scores[i] >= best_score - 30: grade = "C" elif scores[i] >= best_score - 40: grade = "D" else: grade = "F" print("Student", i, "score is", scores[i], "and grade is", grade)
It works but I need two changes:
1. If 2 scores are asked for but 3 are inputted, the first 2 scores should be graded.
2. If fewer scores are inputted than asked for, it asks again to input scores instead of an error.
* 10.I (Assign grades) Write a program that reads a list of scores and then assigns grades based on the following scheme: The grade is A if score is >= best 10. The grade is B if score is >= best 20. The grade is C if score is >= best 30. The grade is D if score is >= best 40. The grade is F otherwise. Here is a sample run
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
