lab 2
unknown
python
2 years ago
852 B
2
Indexable
student = int(input('Enter number of students: ')) if student == 1: scores = list(map(int,input(f'Enter {student} score: ').strip().split())) elif student > 1: scores = list(map(int, input(f'Enter {student} scores: ').strip().split())) grades = list() def student_grades(scores, grades): best = max(scores) for i in range(len(scores)): if scores[i] >= best - 10: grades.append('A') elif scores[i] >= best - 20: grades.append('B') elif scores[i] >= best - 30: grades.append('C') elif scores[i] >= best - 40: grades.append('D') else: grades.append('F') student_grades(scores, grades) 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...