# Part of the Whole - Student becomes Teacher

#1

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 get_average(student):
homework= float(average(student["homework"]))
test_avg= float(average(student["tests"]))
quizzes = float(average(student["quizzes"]))
return (0.1 * homework + 0.60 *test_avg + .30 * quizzes)

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

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

students = [lloyd,alice,tyler]

I am getting the following error..

Oops, try again. get_class_average([alice]) resulted in an error: global name 'average' is not defined

Oddly enough the script works in Python IDLE

#2

on this line

``results = average(results)``

you are calling a function called `average(arg)` but i don't see that function defined anywhere in your code. python does not have any bulit in function called average. You would have to implement that function

#3

Thanks Rydan - you are correct..