I am working on recursion in python is trying to print asterisk using recursion in the form when an user input is given for example: 3 the program should output:
***
**
*
**
***
I have managed to print the output as followed when the user input is given as 3:
***
**
*
When printPatternRecur is called it prints the output i have managed so far
def printPattern(n):
# Base case
if (n < 1):
return
print('*', end = " ")
printPattern(n - 1)
def printPatternRecur(n):
# Base case
if (n < 1):
return
printPattern(n)
print("")
printPatternRecur(n - 1)
The expected output should call recursively as mentioned at the very beginning. Any suggestions towards a simpler approach to solving this problem using recursion is also appreciated. Also would love to know how to overcome the thinking process while working with recursive problems or any articles anyone found useful understanding the concept of recursion. Thank you!