Skip to content

Instantly share code, notes, and snippets.

View oliverseal's full-sized avatar

Oliver Garwil oliverseal

View GitHub Profile
@oliverseal
oliverseal / flatten.py
Created January 12, 2019 22:43
array pancakes (testable with python3 -m unittest test)
def flatten(array):
"""
Drop in an array of a arrays (ex: [[1,2,[3]],4]) and get back a flattened array (ex: [1,2,3,4]).
"""
new_array = []
for i in array:
if not isinstance(i, list):
new_array.append(i)
else: