Created
April 14, 2016 22:34
-
-
Save HaloZero/1911f31f6a64320a4e1c25c38fee16ca to your computer and use it in GitHub Desktop.
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 flatten(arr): | |
new_array = [] | |
for element in arr: | |
if isinstance(element, list): | |
new_array.extend(flatten(element)) | |
else: | |
new_array.append(element) | |
return new_array |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment