lab 2 2
unknown
python
2 years ago
788 B
4
Indexable
student = int(input('Enter number of students: ')) while True: scores = input(f'Enter {student} score(s): ').split() if len(scores) >= student: scores = scores[:student] break def student_grades(scores, grades): best = max(scores) for i in range(len(scores)): if scores[i] >= best - 10: return(A) elif scores[i] >= best - 20: return(B) elif scores[i] >= best - 30: return(C) elif scores[i] >= best - 40: return(D) else: return(F) total_grades = [student_grades(score, max(scores)) for score in scores] for i in range(len(scores)): print('Student {0} has a score of {1} and the grade is {2}'.format(i, scores[i], grades[i]))
Editor is loading...