Using a list in a function


#1

Nope I still get error:
Oops, try again. flatten([[1, 2], [3, 4]]) returned [1, 2, 3, 4, 5, 6, 7, 8, 9] instead of [1, 2, 3, 4]

followed your code


Using a list of lists in a function
#2

that is because its not a solution, its a hint to solve the problem

So, if you would have read, you would have realised its not a solution


#3

but why is it your hint is giving right output yet console shows error


#4

it isn't, this is the output:

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

this is what the ouput should be:

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

the function only works for the list n, not for the other lists i supply as argument


#5

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