18/18 why does my code return none?


#1

my code looks like this. can someone please explain what's the problem with it?
n = [[1, 2, 3], [4, 5, 6, 7, 8, 9]]

Add your function here

def flatten(lists):
results = []
for numbers in n:
for item in numbers:
numbers.append(results)
return results
print flatten(n)


#2

Hello @maru13,

change numbers.append(results) to results.append(item) and you'll be good to go!


#3

thank you it worked!


#4

how about this code?

n = [[1, 2, 3], [4, 5, 6, 7, 8, 9]]

Add your function here

def flatten(lists):
result=[]
for numbers in lists:
for item in numbers:
result.append(item)
return result

print flatten(n)