Answer to Question #275393 in Python for MAX

Question #275393

Write a function declaration for a function called grader that takes a numeric score and returns a letter grade. Grade has one argument of type integer. Use the rule that 90 to 100 is an A, 80 to 89 is a B, 70 to 79 is a C and less than 70 is an F. 


1
Expert's answer
2021-12-04T10:42:20-0500
def getLetterGrade(score):
    score = round(score)
    grades = [(90, 'A'), (80, 'B'), (70, 'C'), (60, 'D'), (0, 'F')]
    for i in range(len(grades)):
        if score >= grades[i][0]:
            return grades[i][1]

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS