Learn Recursion by Solving the Tower of Hanoi Puzzle - Step 44

Tell us what’s happening:

I have tried making the recursive functions, but its not working.

``````NUMBER_OF_DISKS = 4
rods = {
'A': list(range(NUMBER_OF_DISKS, 0, -1)),
'B': [],
'C': []
}

# User Editable Region

def move(n, source, auxiliary, target):
def recursive function((n-1),a,b,c):
if n>0:
# display starting configuration
print(rods, '\n')

# User Editable Region

# initiate call from source A to target C with auxiliary B
move(NUMBER_OF_DISKS, 'A', 'B', 'C')
``````

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36`

Challenge Information:

Learn Recursion by Solving the Tower of Hanoi Puzzle - Step 44

Hello @gomti.agarwal9

The step is not asking you to define another function named `recursive`. It is asking to solve the problem by using a recursive logic.
In this case, it means you have to call the function `move()` which you have already, within itself.
Remember

``````def action():
...
``````

That’s defining a function.
Calling a function would look like this

``````action()
``````

A recursive function would be

``````def action():
action()
``````