Skip to content

Instantly share code, notes, and snippets.

@fletom
Last active October 6, 2015 02:58
A concise generator of the rows of Pascal's triangle
def pascals_triangle():
row = [1]
while True:
yield row
row = map(sum, zip([0] + row, row + [0]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment