Can someone please tell me what is wrong with my code


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


Check indentation of:


this line contains multiply problems:

results = results + results[number]

number contains the numbers in the list, not the indexes. so you need number, not results[number], to add items to a list use .append(), + is for joining strings

take a look at the indent of this line:

return results

a function ends the moment a return keyword is reached, which means your for numbers in lists will run only once, you might want to re-indent your return


Thank you
it is now fixed