# Sending a Letter

#1

Error code is:

``````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]
}

def average(numbers):
total = (float(sum(numbers)))/len(numbers)
def get_average(student):
homework= average(student["homework"])
quizzes = average(student["quizzes"])
tests = average (student["tests"])
return homework*0.10 + quizzes*0.30 + tests*0.60
if score > 90:
return "A"
elif score >= 80 and score < 90:
return "B"
elif score >= 70 and score < 80:
return "C"
elif score >= 60 and score < 70:
return "D"
else:
return "F"

#2

Take a look at the conditional operator you have chosen for the first if statement in the function get_letter_grade. Essentially what is happening is that when 90 is inputted, it does not match any of the statements so it gets to the else and returns 'F'.

#3

i put in, int = score and made if score >= 90 but now it says, get_letter_grades(89) returned A instead of B as expected

#4

**i put in score = int

#5

Assuming all you changed was score >= 90 then it 89 should return B. Can you post the code that you are now using?

#6

nevermind, i took out score = int now and it works since i fixed the 90 thing. thank you

#7

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