8/9 error: 'NoneType' object is not iterable


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 total/len(numbers)
def get_average(students):
net_average= 0.1*homework+ 0.3*quizzes+ 0.6*tests
return net_average
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"
return "F"

def get_class_average(y):
for x in y:
return average(results)

it resulted in an error:
Oops, try again. get_class_average([alice]) resulted in an error: 'NoneType' object is not iterable


Try running the code in your post. Do you get the same error?
The code in your post is not intact, that's a problem if you're going to ask about your own code.

None is a value, it represents lack of value.

For example, a function that does not explicitly return anything, returns None.

You can't iterate through this value.

Reproduce what the codecademy error message tells you that your code fails on, this will get you the full error message to show up in the console message which will have more information, in particular a line number which you can add prints at to find out what was going on there.


results = results.append(get_average(x))

That is the problem

You add an element to a list by simply calling .append() on the list


.append() returns None and in your current code you're assigning it back to results


I am confused by what you mean. I have the same error as his.
I am using x as student, and y as students.