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

Tell us what’s happening:

“You should use the range() function to assign a sequence of numbers to rods[‘A’]. The syntax for calling the range() function is range(x, y, h).”

Your code so far


# User Editable Region

rods = {
    'A': [range(3-1)], 
    'B': [],
    'C': []
}

# User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36

Challenge Information:

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

As explained in the instructions:

The syntax is range(x, y, h) , where x is the starting integer (inclusive), y is the last integer (not inclusive), and h is the difference between a number and the next one in the sequence.

Your syntax does not match this. Also, you don’t need the square brackets around the range() method, as it will generate a list automatically.

HINT: When counting downwards, h will be a negative integer.

1 Like

I’m still not quite getting it

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

never mind I got it thanks

1 Like