Skip to content

Instantly share code, notes, and snippets.

@ptantiku
Created December 4, 2015 19:20
Show Gist options
  • Save ptantiku/5dbb65ed979bbb5afb4d to your computer and use it in GitHub Desktop.
Save ptantiku/5dbb65ed979bbb5afb4d to your computer and use it in GitHub Desktop.
Pascal Triangle
#!/usr/bin/env python
#idea from: https://rossta.net/blog/pascals-triangle-with-rubys-enumerator.html
row=[1]
print row
for i in xrange(10):
row=[ sum(x) for x in zip([0]+row, row+[0]) ]
print row
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment