LearnPy Hub
← Recursion & Lambda problems
Hard

Flatten Nested Lists

The input is a nested Python list like [1, [2, [3, 4]], 5]. Read it with eval(input()) and print all numbers in order on one line, using recursion.

Input

One nested list.

Output

One line.

Sample 1

Input
[1, [2, [3, 4]], 5]
Output
1 2 3 4 5

Sample 2

Input
[[[[7]]]]
Output
7
solution.py
Output appears here
Flatten Nested Lists · Python practice problem · LearnPy Hub