Victoria - 17 days ago 8

Python Question

I am new to python and I need to write a recursive python program but I need some guidance on how to get started. I have never come across a problem like this so any help would be greatly appreciated.

The recursive function that will print all the integers between n and 1 in descending order. Pass the value n = 4 to the function.

`def function(n):`

if n>0 or n==1:

Return 4

Answer

Your answer should look something like this. The function has to be called within itself for it to be recursive. Therefore, while it meets a certain condition, a recursive function, as given below, should call itself.

```
def function(n):
if n>0:
print(n)
function(n-1)
```