# Stuck on sending a letter, keep getting the same error despite the function printing the right letter grade to the console

#1

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

i keep getting the error "Oops, try again. get_letter_grade(100) returned None instead of 'A' as expected."

when printing the function get_letter_grade the function runs properly and prints the correct letter grades to the console. I have ran the function for all three students and got the correct letter grades.

``````lloyd = {
"name": "Lloyd",
"homework": [90.0, 97.0, 75.0, 92.0],
"quizzes": [88.0, 40.0, 94.0],
"tests": [75.0, 90.0]
}
alice = {
"name": "Alice",
"homework": [100.0, 92.0, 98.0, 100.0],
"quizzes": [82.0, 83.0, 91.0],
"tests": [89.0, 97.0]
}
tyler = {
"name": "Tyler",
"homework": [0.0, 87.0, 75.0, 22.0],
"quizzes": [0.0, 75.0, 78.0],
"tests": [100.0, 100.0]
}

# Add your function below!
def average(numbers):
total = sum(numbers)
total = float(total)
return total / len(numbers)

def get_average(student):
homework= average(student["homework"])
quizzes =  average(student["quizzes"])
tests = average(student["tests"])

weighted_homework = homework * 0.1
weighted_quizzes= quizzes *0.3
weighted_tests=  tests * 0.6

return weighted_homework +   weighted_quizzes + weighted_tests

def get_letter_grade(score):
if score >= 90:
print "A"
elif score >= 80:
print "B"
elif score >= 70:
print "C"
elif score >=60:
print "D"
else:
print "F"
print(get_letter_grade(get_average(lloyd)

B
None
None
this is what appears in the console after running the function``````

#2

Your function should return a letter, not print it.

#3

Thank you! That fixed everything

#4

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