Login and get codingComplete
flatten
that takes a list of lists (which can have lists ad infinitum) and flatten them into a one dimensional list.So this input:
[1, [2, 3], [4, 5, [6, 7, [8, 9, 10]]]]... should generate this output:
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10](Making this a generator is fine too, the test will convert that into a
list
).Make sure you support both
list
s andtuple
s. You probably want to use recursion here ... have fun!
181 out of 184 users completed this Bite.
Will you be Pythonista #182 to crack this Bite?
Resolution time: ~38 min. (avg. submissions of 5-240 min.)
Pythonistas rate this Bite 4.38 on a 1-10 difficulty scale.
» Up for a challenge? 💪