# Following Instructions incorrectly?

#1

I did as the instructions ask:
1. First, make an empty list called results.
2. For each student item in the class list, calculate get_average(student) and then call results.append() with that result.
3. Finally, return the result of calling average() with results.

The error I get is that the average of all the scores is incorrect. I get 83.86, but it is saying I should get 91.15.
I have a theory of why this is, but I feel like I would have to veer off what the instructions are asking of me to complete.

I am thinking that if I combine the keys(homework, quizzes, test) of each student then do the "get_average" function of that list then i'd be getting the 91.15 its saying I should get. I don't think that's what the instructions are asking of me though.. so I want to see how i'm following the instructions wrong.

``````#added this question to the beginning - ignore

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

students = [lloyd,alice,tyler]

def average(numbers):
total = sum(numbers)
return float(total) / len(numbers)

def get_average(student):
avg = 0
homework = average(student["homework"])
quizzes = average(student["quizzes"])
tests = average(student["tests"])
avg += homework * .10
avg += quizzes * .30
avg += tests * .60

return avg

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

#added function for question in the beginning - ignore
if name == "Alice":
elif name == "Lloyd":
elif name == "Tyler":
else:

results = []

def get_class_average(students):
results.append(get_average(alice))
results.append(get_average(lloyd))
results.append(get_average(tyler))
return average(results)

print "class average:"
print get_class_average(students)``````

#2

this code looks different from the exercise?

anyway, your `get_class_average` should be able to calculate the average for a single students, two students (any possible combination) and all 3 students, this is currently not possible with your code

follow the instructions from the lesson to make this possible.

#3

Derp I fixed it. I forgot a for loop in my function. Ty for help

#4