Question as in the title. I'm not sure why function "flatten2" works; (flatten1 & flatten2 return same result)
If I prompt for len() of list 'n' then I get 2. So I feel like I have to iterate loop twice to get into the elements inside any of the 2 lists. I think I'm missing some concept here (?).
I'd be greatful !
n = [[1, 2, 3], [4, 5, 6, 7, 8, 9]] def flatten1(lists): results =  for x in lists: for items in x: results.append(items) return results print flatten1(n) def flatten2(lists): results =  for numbers in lists: results += numbers return results print flatten2(n)