Sending a Letter


#1



https://www.codecademy.com/courses/python-beginner-en-qzsCL/1/3?curriculum_id=4f89dab3d788890003000096


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

80.55
A
None

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"
    else:
        return "F"

print get_average(lloyd)
print get_letter_grade(lloyd)


#2

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


#3

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


#4

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


#5

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