Skip to content

Instantly share code, notes, and snippets.

@CodeMaster7000
Created December 24, 2021 12:35
Show Gist options
  • Select an option

  • Save CodeMaster7000/690dd03196f3546c6136ad445258dbfd to your computer and use it in GitHub Desktop.

Select an option

Save CodeMaster7000/690dd03196f3546c6136ad445258dbfd to your computer and use it in GitHub Desktop.
Pascal's Triangle in Python 3.
row = int(input("Enter number of rows: "))
space = 36
a = [0] * 20
print("\n\t\t\t\t PASCAL'S TRIANGLE\n")
for i in range(row):
for spi in range(1,space+1):
print(" ", end="")
a[i] = 1
for j in range(i+1):
print('%6d' %(a[j]), end = "")
for j in range(i,0,-1):
a[j] = a[j] + a[j-1]
space = space - 3
print()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment