Last active
February 7, 2018 11:54
-
-
Save averjr/1da7fe0e9ceb2f9cd0dc104925dadbbe to your computer and use it in GitHub Desktop.
Flat array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def flater(arr): | |
result = [] | |
for el in arr: | |
if isinstance(el, list): | |
result = result + flater(el) | |
else: | |
result.append(el) | |
return result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment