Skip to content

Instantly share code, notes, and snippets.

@z2s8
Forked from lmaresz/Pascal triangle
Last active August 29, 2015 14:17
Show Gist options
  • Save z2s8/ea5ac30a804e04102886 to your computer and use it in GitHub Desktop.
Save z2s8/ea5ac30a804e04102886 to your computer and use it in GitHub Desktop.
import os
def faktorialis (a):
s = 1
for szam in range(1,a+1):
s = s*szam
return s
a = int(input ("szam:"))
def pascalharomszog (i):
for n in range(i):
s = ""
for k in range (n+1):
e = faktorialis(n)
f = faktorialis(n-k)
g = faktorialis(k)
s = s + str(int((e/(f*g))))+" "
print (s.center(int(os.popen('stty size', 'r').read().split()[1]), " "))
pascalharomszog(a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment