18/18 difference between using 1 for loop and 2 loops


Hey! :slight_smile: so i tried to do exercice 18 in two different ways and they are both ok but i'd like to understand why it works with one loop as well as it does with 2. it might be a dumb question but i'm not so good at programming yet and i'd like to see the difference between the two codes. thanks a lot :slight_smile:

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

def flatten(lists):
    for numbers in lists:
    return results

print flatten(n)

#OOOR as it was described in the exercice:
for numbers in lists:  
    for i in numbers:


that a difficult question, someone wrote a good answer here, but it requires good understanding :slight_smile:


thanks, i'll check it out :slight_smile:


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