Add flatten_array solution for U3
This commit is contained in:
parent
90c104bead
commit
9c73711444
10
u3/flatten_array.py
Normal file
10
u3/flatten_array.py
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
def flatten(iterable):
|
||||||
|
pusti = []
|
||||||
|
for gns in iterable:
|
||||||
|
if gns is None:
|
||||||
|
continue
|
||||||
|
elif isinstance(gns, (list, tuple)):
|
||||||
|
pusti.extend(flatten(gns))
|
||||||
|
else:
|
||||||
|
pusti.append(gns)
|
||||||
|
return pusti
|
||||||
Loading…
Reference in New Issue
Block a user