Get grade letter
Define a function get_grade_letter
that receives a score and you should return:
'A' if the score is 90 or above
'B' if the score is 80 to 89
'C' if the score is 70 to 79
'D' if the score is 60 to 69
'F' if the score is less than 60
Examples:
>>> get_grade_letter(93)
'A'
>>> get_grade_letter(80)
'B'
>>> get_grade_letter(75)
'C'
>>> get_grade_letter(67)
'D'
>>> get_grade_letter(42)
'F'
Test Cases
Solution 1
def get_grade_letter(score):
if score >= 90:
return 'A'
elif score >= 80:
return 'B'
elif score >= 70:
return 'C'
elif score >= 60:
return 'D'
else:
return 'F'