Created
December 4, 2015 19:20
-
-
Save ptantiku/5dbb65ed979bbb5afb4d to your computer and use it in GitHub Desktop.
Pascal Triangle
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 characters
#!/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