8. part of a whole


#1

def get_class_average(class_list):
results=[]
for student in class_list:
get_average(student.append(results))
return average(results)
i am getting this error get_class_average([alice]) resulted in an error: ‘dict’ object has no attribute 'append’
i am stuck here for a while …can anyone you please correct the code for me …i cannot understand what is wrong …


Part of a Whole
#2

so here:

get_average(student.append(results))

you appending a list (results) to a dictionary (student), as the error message tells you, dictionary (student) doesn’t have a append method, given its a method for lists


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.