solutions

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

test F score - Run Test

def test_F_score():
    assert get_grade_letter(42) == 'F'

test C score - Run Test

def test_C_score():
    assert get_grade_letter(75) == 'C'

test A score - Run Test

def test_A_score():
    assert get_grade_letter(93) == 'A'

test B score - Run Test

def test_B_score():
    assert get_grade_letter(80) == 'B'

test D score - Run Test

def test_D_score():
    assert get_grade_letter(67) == 'D'