← Back to challenges

Extremely Over-Nested

PythonHardarraysformattingloops

Instructions

Create a function that returns the original value from a list with too many sub-lists.

Examples

de_nest([[[[[[[[[[[[3]]]]]]]]]]]]) ➞ 3

de_nest([[[[[[[True]]]]]]]) ➞ True

de_nest([[[[[[[[[[[[[[[[["innokodakademija"]]]]]]]]]]]]]]]]]) ➞ "innokodakademija"

Notes

You only need to retrieve one element.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Narcissistic Numbers