This function you wrote is not recursive!
Recursion is when a function calls itself. You have written an iterative function.
Look at this code:
def Recursiva(n):
if n == 1:
print(n)
return
print(n)
Recursiva(n-1)
print(n)
Recursiva(5)
Upshot:
5
4
3
2
1
2
3
4
5
Every recursive function must have a stop criterion, in which case the criterion is that the parameter n being passed is 1.
Then when you call the Recursive function for the first time and pass a number as parameter, it will check if that number is 1, if it is it prints and returns the function, if it is not it prints the number and calls the Recursive with n-1. At the time the criterion is reached, the function calls will be returned and ending the rest of the function where they were called. Printing numbers increasing in value.
It was clear?
Understood! Thank you very much!
– dev34