Created
July 5, 2016 11:23
-
-
Save LotusChing/ab7307b8fbd7fa4ad8db2a6849c61960 to your computer and use it in GitHub Desktop.
pascal_triangle
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
def pascal_triangle(m): | |
n, b = 0, [1] | |
print(b) | |
while n < m: | |
b = [1] + [b[i] + b[i + 1] for i in range(len(b) - 1)] + [1] | |
print(b) | |
n += 1 | |
pascal_triangle(10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment