SQLDAXExcelPython
Leaderboard
Core PythonMedium20 points

Flatten a nested list

Complete flatten(items) so a list nested to any depth becomes one flat list, in the same order.

How your answer is tested

After your code, this runs and its result is checked:

result = flatten([1, [2, [3, 4]], [], 5, [[6]]])
Show solutionLifetime

Real Python running in your browser through Pyodide, with pandas available. Nothing you type is sent to a server unless you save a score.

Python
Loading editor…

Press Ctrl+Enter or Run to see the result here.