18/18 issues


#1

Could someone help me? I've looked around the forums but I still have no idea what I am doing wrong.

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

def flatten(lists):
    results = []
    for number in lists:
        for i in lists:
            results.append(i)
    return results

print flatten(n)

Thanks :slightly_smiling:


#2

My best guess without knowing the error thrown would be to change for i in lists: to for i in number:

Can you guess why?


#3

Thin line

represents each list in the target list(you call it number). Now you want yo go through each of those list hence this line

should rather be


for i in number

Ohh i i guess @gaurangtandon has already provided an answer :grinning:


#4

We both posted at exactly the same time :stuck_out_tongue:


#5

Thanks that really helped :sweat_smile: