question 111 Collection Algorithms · easy
Letter grades for a class
A teacher exports raw scores and wants the letter grade for each student, in the same order, to paste next to the names.
Function
letter_grades(scores)scoresa list of whole-number scores from 0 to 100
Returnsa new list with one letter per score:
"A" for 90 and up, "B" for 80–89, "C" for 70–79, "D" for 60–69, otherwise "F"Rulesevery score gets a letter, including failing ones; the list may be empty
Examples
callletter_grades([95, 72, 58])returns['A', 'C', 'F']
callletter_grades([80, 89, 61])returns['B', 'B', 'D']
callletter_grades([])returns[]