curriculum/challenges/english/blocks/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64dcd3d61c448e2676501f43.md
When the remainder of the move number divided by 3 is equal to 2, the movement is allowed between 'A' and 'B' (the source and the auxiliary rods).
Add an elif statement for that. Then, print the appropriate string if the condition is met.
You should have an elif statement to execute when remainder == 2.
({test: () => assert.match(code, /elif\s+remainder\s*==\s*2:/)})
You should print the string f'Move {i + 1} allowed between {source} and {auxiliary}'.
({test: () => assert.match(code, /print\s*\(\s*f('|")Move\s\{\s*i\s*\+\s*1\s*\}\sallowed\sbetween\s\{\s*source\s*\}\sand\s\{\s*auxiliary\s*\s*\}\1\s*\)/)})
NUMBER_OF_DISKS = 3
number_of_moves = 2**NUMBER_OF_DISKS - 1
rods = {
'A': list(range(NUMBER_OF_DISKS, 0, -1)),
'B': [],
'C': []
}
--fcc-editable-region--
def move(n, source, auxiliary, target):
# display starting configuration
print(rods)
for i in range(number_of_moves):
remainder = (i + 1) % 3
if remainder == 1:
print(f'Move {i + 1} allowed between {source} and {target}')
--fcc-editable-region--
# initiate call from source A to target C with auxiliary B
move(NUMBER_OF_DISKS, 'A', 'B', 'C')