List of list


#1

n = [[1, 2, 3], [4, 5, 6, 7, 8, 9]]
# Add your function here
def flatten(lists):
    results = [ ]
    for list in lists:
        for number in list:
            
            results = results.append(number)
    return results



print flatten(n)

What i'm I doing wrong ?
Error 'Nonetype' object has no attribute


#2

append will update the variable, so you don't need to set the variable to a new value, you can just do:

results.append(number)

#3

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