# Learn Recursion by Solving the Tower of Hanoi Puzzle - Step 46

### Tell us what’s happening:

NUMBER_OF_DISKS = 4
rods = {
‘A’: list(range(NUMBER_OF_DISKS, 0, -1)),
‘B’: ,
‘C’:
}

def move(n, source, auxiliary, target):
if n > 0:
# move n - 1 disks from source to auxiliary, so they are out of the way
move(n - 1, source, auxiliary, target)

``````    # display starting configuration
rods[target].append(rods[source[-1]])
rods[source].pop()
print(rods, '\n')
``````

# initiate call from source A to target C with auxil

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

# User Editable Region

def move(n, source, auxiliary, target):
if n > 0:
# move n - 1 disks from source to auxiliary, so they are out of the way
move(n - 1, source, auxiliary, target)

# display starting configuration
rods[target].append(rods[source[-1]])
rods[source].pop()
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 (Macintosh; Intel Mac OS X 10_15_7) 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 46

Hi! I’m not sure why this isn’t working. This is my code for the Scientific Computing with Python module Hanoi puzzle Q46

It is just one line statement what it expects.
Remove `rods[source[-1]]` and substitute it for the second line `rods[source].pop()` inside the parenthesis of` rods[target].append()`

By default `.pop()` does remove the last element.

1 Like

Okay, this is the line that I’m trying:
rods[target].append(rods[source].pop())

84% of the way through now! Thank you!

1 Like

The key is to `grok` the concepts more than get the steps marked.
Best wishes moving forward.

HELLO, can you help me to figure out the 31st step of this I cant understand it at all

If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Ask for Help button located on the challenge (it looks like a question mark). This button only appears if you have tried to submit an answer at least three times.

The Ask for Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.