So I'm trying to implement a pascal's triangle that produces the following in python:
pascal_triangle(5) prints:
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
The problem is I'm trying to do it without using any type of loops but can't figure out how to do that. Any help would be appreciated. Than you.
This is what I have so far:
def factorial(x):
if x == 0:
return 1
else:
x * factorial(x - 1)
def pascal_triangle(n):`
UPDATED:
print_pascal_line(r):
if r == 0:
return 1
else:
R = print_pascal_line(r-1)
return 1 +