# Getting ERROR message making me confused!

#1

Not sure why I am getting this error Oops, try again. Did you remember to print the average of the class? It looks like "None" wasn't printed. thou I have given print statements.

``````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)
total = float(total)
l = len(numbers)

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

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

def get_class_average(students):
results = []
for stud in students:
results.append(get_average(stud))
print stud['name']
print stud['homework']
print stud['quizzes']
print stud['tests']
print get_average(stud)
print results
print "class average : ",average(results)

get_class_average(students)``````

#2

Looks to me like you are printing in the function and not returning a value to get printed.

Example::

``return get_letter_grade(average(results))``

#3

Basically in every function you should be returning a result NOT printing it

Then call the functions outside the functions themselves and print them
example:

``````def get_letter_grade(score):
if score >= 90:
return "A"
elif score >= 80:
return "B"
elif score >= 70:
return "C"
elif score >= 60:
return "D"
else:
return "F"