I hope there are people here who also decide on the Checkio fan problem. Faced the solution of the problem Flatten a list. https://py.checkio.org/mission/flatten-list/
In PyCharme my code is:
a = [] def flat_list(array): global a [flat_list(i) if isinstance(i,list) else a.append(int(i)) for i in array] return a print(flat_list([1,[2,2,2],4])) gives the result: [1, 2, 2, 2, 4]
On Chekio, the result: [1,2,3,1,2,2,2,4] and the test does not pass (rewrote the solution when the test passed, but the question is exactly why this code is wrapped with this result.
Question: why such a different interpretation of the code? (python versions are the same)
flat_list = lambda array: [j for i in array for j in (flat_list(i) if isinstance(i, list) else [i])]- andreymal