Created
February 12, 2017 23:59
-
-
Save freewayz/30ab37f54f88f1509c9983bdbf00560d to your computer and use it in GitHub Desktop.
Revisions
-
freewayz created this gist
Feb 12, 2017 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ def flatten_array(arr): output = [] for val in arr: if type(val) == list: # is the current value we are looking at is also a list output.extend(flatten_array(val)) # then recursive call itself to start from # the beginning and use python list extend else: output.append(val) # ok this is not a list just append to the bottom return output