Write a function get_letter_grade, such that when given * a lab grade score and * a list of the grade cutoffs returns the letter grade of that score. Note: Your function automatically returns A for the values that are >= to the first cutoff-value in the list, then A- for the second cutoff-value, B+ for the third and so on. The function returns None for anything that's below the score for B-. You test that get_letter_grade(97, [93, 90, 87, 83, 80]) correctly returns an A, and get_letter_grade(93, [97, 90, 87, 83, 80]) returns A-. DO NOT hard-code the cutoffs, since they can change! You can copy/paste the following template: def get_letter_grade(score, cutoffs): if score ... : return 'A' ...: return 'A-' ...: return 'B+' ...: return 'B' ...: return 'B-'
-Python-
Write a function get_letter_grade, such that when given
* a lab grade score and
* a list of the grade cutoffs
returns the letter grade of that score.
Note: Your function automatically returns A for the values that are >= to the first cutoff-value in the list, then A- for the second cutoff-value, B+ for the third and so on. The function returns None for anything that's below the score for B-.
You test that get_letter_grade(97, [93, 90, 87, 83, 80]) correctly returns an A, and get_letter_grade(93, [97, 90, 87, 83, 80]) returns A-.
DO NOT hard-code the cutoffs, since they can change!
You can copy/paste the following template:
def get_letter_grade(score, cutoffs):
if score ... :
return 'A'
...:
return 'A-'
...:
return 'B+'
...:
return 'B'
...:
return 'B-'

Trending now
This is a popular solution!
Step by step
Solved in 2 steps









