I have to write a recursive function asterisk_triangle which takes an integer and then returns an asterisk triangle consisting of that many lines.
For e.g this is a 4 line asterisk triangle.
*
**
***
****
I came up with this function:
def asterisk_triangle(n):
"""
takes an integer n and then returns an
asterisk triangle consisting of (n) many lines
"""
x = 1
while (x <= n):
print("*" * x)
x = x + 1
return
And also I had to create an upside down asterisk triangle by manipulating the first function.
I came up with this function and result:
def upside_down_asterisk_triangle(n):
"""
takes an integer n and then returns a backwards
asteris