Hi, I am very stuck and confused on the exercise “Using a list of lists in a function”, could some one help me please.
Create a function called flatten that takes a single list and concatenates all the sublists that are part of it into a single list.
On line 3, define a function called flatten with one argument called lists.
Make a new, empty list called results.
Iterate through lists. Call the looping variable numbers.
Iterate through numbers.
For each number, .append() it to results.
Finally, return results from your function.
The error I get:
flatten([[1, 2], [3, 4]]) returned [[1, 2], [1, 2], [3, 4], [3, 4]] instead of [1, 2, 3, 4]
n = [[1, 2, 3], [4, 5, 6, 7, 8, 9]] # Add your function here def flatten(lists): result =  for numbers in lists: for number in numbers: result == result.append(numbers) return result print flatten(n)