# Error on 9/9

#1

Hi this is my code and I keep getting an error stating that 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. so any help on this topic would be very helpful

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

def get_average(student):
homework = average(student['homework'])
quiz = average(student['quizzes'])
test = average(student['tests'])
Averages = (0.10 * homework)+(0.30 * quiz)+(0.60 * test)
return Averages

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(student))
return average(results)

print get_class_average(students)

#2

Marked your code as preformatted text - take care to get this right as it's essential information.

#3

Sorry I don't quite understand as to how I should make the changes or where I have gone wrong.

#4

Consider these two:

``````for i in range(5):
print i``````

for i in range(5):
print i

One is valid code, the other not so much. The forum has a bunch of formatting tools and will misinterpret code unless you mark it as such - that's what the buttons in the post editor are for.

If you post code that is different from what you're actually using, then you're making it less likely that you get satisfactory help (also less fun for those helping)

#5

its quizzes and tests . you misspelt them bro

#6

This code worked for me
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)
total /= len(numbers)
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"