lab 2 2

mail@pastecode.io avatar
unknown
python
a year ago
788 B
1
Indexable
Never
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]))