Skip to content

Instantly share code, notes, and snippets.

View oliverseal's full-sized avatar
🐦
Sir, it is broad daylight.

Oliver Garwil oliverseal

🐦
Sir, it is broad daylight.
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: