Using lists of lists in a function


#1



https://www.codecademy.com/courses/python-beginner-nzzVa/4/2?curriculum_id=4f89dab3d788890003000096#


Traceback (most recent call last):
File "python", line 14, in
File "python", line 6, in flatten
TypeError: object of type 'int' has no len()


Can anyone explain why I get this error? According to my understanding, in my code the variable 'numbers' is a list, but the error message is telling me it is an int?


Replace this line with your code.


#2

def flatten(lists):
results = []
for numbers in range(0, len(lists)):
for y in range(0, len(numbers)):
results.append(y)
return results


#3

Sorry here is my code


#4

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