18. List of lists in function


#1

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/courses/python-beginner-nzzVa/4/2?curriculum_id=4f89dab3d788890003000096#

<In what way does your code behave incorrectly? Include ALL error messages.>
File “python”, line 7
for numbers in item
^
SyntaxError: invalid syntax

<What do you expect to happen instead?>

```python

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

Add your function here

def flatten(lists):
results = []
for item in lists:
print item
numbers = item
results.append(numbers)
return results

print flatten(n)

<do not remove the three backticks above>

#2

If that is for debugging, comment or remove.

Not necessary.

for number in item:
    results.append(number)

#4

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