Created
December 8, 2013 13:24
-
-
Save sakadonohito/7857478 to your computer and use it in GitHub Desktop.
pythonでパスカルの三角形
This file contains 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/python | |
if __name__ == '__main__': | |
num = raw_input() | |
num = int(num) if num else 10 | |
l = [1] | |
print l | |
for i in range(num): | |
l = map(lambda x,y:x+y,[0]+l,l+[0]) | |
print l |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment