# How is Everybody Doing?

#1

Oops, try again. One of the following is missing or broken when we tried to use it: alice, lloyd, tyler, students, get_class_average, get_letter_grade

Hi,
Just can't figure out the problem. I looked at many others of the same topic and tried many different ways indentions, etc. Nothing works. Is there a typo somewhere I can't spot out?

``````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)

def get_average(student):
homework = average(student["homework"])
quizzes = average(student["quizzes"])
tests = average(student["tests"])
return (homework*0.1)+(quizzes*0.3)+(tests*0.6)

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:
results.append(get_average(students))
return average(results)

students = [lloyd, alice, tyler]

print get_class_average(students)

#2

these lines:

``````      students = [lloyd, alice, tyler]

print get_class_average(students)

have the wrong indent, `students` should be a global variable an the function calls should be outside the function given they execute the function

#3

I made that change, still doesn't work:

``````students = [lloyd, alice, tyler]

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)

def get_average(student):
homework = average(student["homework"])
quizzes = average(student["quizzes"])
tests = average(student["tests"])
return (homework*0.1)+(quizzes*0.3)+(tests*0.6)

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:
results.append(get_average(students))
return average(results)

print get_class_average(students)

#4

the list should be after the dictionaries, you can't insert dictionaries you haven't defined yet in a list

#5

Thanks again. I moved it there, still the same message:
Oops, try again. One of the following is missing or broken when we tried to use it: alice, lloyd, tyler, students, get_class_average, get_letter_grade

#6

i would look at the error message interpreter now, much more useful. Here:

``results.append(get_average(students))``

students is a list, get_average can't handle list as argument, only a individual student, that is why you have a loop

#7

Thanks again. changing students to student fixed it. Never noticed the extra 's' at the end. I know it was a typo somewhere.
Many thanks for your help again.

#8