I tried everything (in my knowledge) from splitting the array and joining them up together and even using itertools:
import itertools
def oneDArray(x):
return list(itertools.chain(*x))
The result I want:
a) print oneDArray([1,[2,2,2],4]) == [1,2,2,2,4]
Strangely, it works for
b) print oneDArray([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) == [1, 2, 3, 4, 5, 6, 7, 8, 9]
Question 1) How do I get part a to work the way I want (any hints?)
Question 2) Why does the following code above work for part b and not part a??