I do need to create two recursive functions in Python. the first function should create a pyramid with a given parameter n. for example pyramid(3) should have the following output
*
***
*****
I came up with the following function:
def pyramid(n, i=0):
if n == 0:
return 0
else:
print(" "*(n-1) +"*"*(2*i+1)+ " "*(n-1))
return pyramid(n-1, i+1)
Now I do need to create a second recursive function pyramid_seq with 2 parameters n,k what prints a sequence of pyramids in with height of n. for example pyramid_seq(3,4) should have the following output:
* * * *
*** *** *** ***
********************