# 8/9 Student Becomes The Teacher

#1

<Below this line, add a link to the EXACT exercise that you are stuck at.>

<In what way does your code behave incorrectly? Include ALL error messages.>
Make sure you have defined get_class_average

<What do you expect to happen instead?>
I don’t know what I am doing here. I feel like I have clearly defined what get_class_average is, but the code seems to disagree. Could anyone shed light on this? And this isn’t a one time thing, I keep having this error message repeat even after changing the code somewhat.

``````
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 = sum(numbers)
total = float(total)
am = total / len(numbers)
return am

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)

if score >= 90:
return "A"
elif score >= 80:
return "B"
elif score >= 70:
return "C"
elif score >= 60:
return "D"
else:
return "F"

class_list = [lloyd, alice, tyler]

def get_class_average(class_list):
results = []
for student in class_list:
results.append(get_average(student))
return average(results)

``````

#2

but your `get_class_average` function is part of your `get_letter_grade function`, why?

get_class_average should be outside/after your get_letter_grade function, same goes for your `class_list`, the `class_list` should have a global scope

#3

Didn’t see that, thank you, it works now.

#4