hello,
I was wondering if I could recieve some help?
The function I am writing is called pyramid, it consumes a number and produces stars(*) from 1 to that number. For example pyramid(5) would be:
*
**
***
****
*****
so far I have a function that does that backwards and it's
def leftTriangle(n):
"""
consumes: a number
produces: that amount of stars all the way down to 1
"""
"""
>>> leftTriangle(4)
****
***
**
*
"""
if n == 0:
return
if n> 0:
print n * ('*')
leftTriangle(n-1)
and the code so far for the pyramid function that I am trying to create is
def pyramid(n):
if n==0:
print
if n>0:
print ((((n-n)+1)* ('*'))
I am not sure what I could add in there where it could go up from 1 star to the number given. Any help?