Part of whole


#1

I have the same problem, but the error says:
Oops, try again. get_class_average([alice]) returned 83.8666666667 instead of 91.15 as expected

I have the return keyword outside of my loop.


Part of the Whole
#2

The code should include the return keyword, but for some reason it returns the wrong number? Not sure why that is.


#3

def get_class_average(students):
results = []
students = [lloyd, alice, tyler]
for student in students:
results.append(get_average(student))
return average(results)

This is how I have my code. Is there any changes I need to make?


#4

why bother to give your function a parameter if you are going to overwrite it anyway?


#5

I don't know, it says to give the function a parameter but then it says that there is an invalid syntax if I delete the 'students' list.


#6

Just deleted the students list... It works now, but instead of making the loop "for student in class" like it asks, I had to change it to "for student in students".


#7

yes, you have to loop over the parameter so your function works any argument supplied at function call


#8

Thanks, was just confused for a bit there. :slight_smile:


#9