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-'

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter6: Modularity Using Functions
Section6.4: A Case Study: Rectangular To Polar Coordinate Conversion
Problem 9E: (Numerical) Write a program that tests the effectiveness of the rand() library function. Start by...
icon
Related questions
Question

-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-'

 

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Datatypes
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr