Sending a Letter


The code runs and prints this to the terminal...


Codecademy says it's a pass and lets me move onto the next section, however, it should return "B"

def get_average(student):
    homework = average(student["homework"])
    quizzes = average(student["quizzes"])
    tests = average(student["tests"])
    return 0.1 * homework + 0.3 * quizzes + 0.6 * tests
def get_letter_grade(score):
    if score >= 90:
        return "A"
    elif score >= 80:
        return "B"
    elif score >= 70:
        return "C"
    elif score >= 60:
        return "D"
        return "F"

print get_average(lloyd)
print get_letter_grade(lloyd)


get_letter_grade converts a number grade into a letter grade, you so would need to supply get_average(lloyd) as argument to get_letter_grade()

you currently supply a dictionary to get_letter_grade as argument, this doesn't work


A post was split to a new topic: Sending a letter


A post was merged into an existing topic: Sending a letter


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.