Update u3/flatten_array.py
This commit is contained in:
parent
3fef7e8440
commit
a9053e5f7d
@ -2,7 +2,7 @@ def flatten(iterable):
|
||||
result = []
|
||||
for item in iterable:
|
||||
if isinstance(item, (list, tuple)):
|
||||
# is the element is a list or a tuple, we call 'flatten' recursively /// Ak je prvok zoznamom alebo tupľom, voláme funkciu flatten rekurzívne
|
||||
# is the element is a list or a tuple, we call 'flatten' recursively /// Ak je prvok zoznamom alebo konvojom, voláme funkciu flatten rekurzívne
|
||||
result.extend(flatten(item))
|
||||
elif item is not None:
|
||||
# pridame prvok len vtedy, ak nie je None /// add an element only if it is not None
|
||||
|
||||
Loading…
Reference in New Issue
Block a user