Skip to content

Instantly share code, notes, and snippets.

@LotusChing
Created July 5, 2016 11:23
Show Gist options
  • Save LotusChing/ab7307b8fbd7fa4ad8db2a6849c61960 to your computer and use it in GitHub Desktop.
Save LotusChing/ab7307b8fbd7fa4ad8db2a6849c61960 to your computer and use it in GitHub Desktop.
pascal_triangle
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