curriculum/challenges/english/blocks/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64dcd9bbc2268127e7898d77.md
Finally, when the move number divided by 3 has no remainder, the movement is allowed between 'B' and 'C'.
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 == 0.
({test: () => assert.match(code, /elif\s+remainder\s*==\s*0\s*:/)})
You should print the string f'Move {i + 1} allowed between {auxiliary} and {target}'.
({test: () => assert.match(code, /print\s*\(\s*f('|")Move\s\{\s*i\s*\+\s*1\s*\}\sallowed\sbetween\s\{\s*auxiliary\s*\}\sand\s\{\s*target\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}')
elif remainder == 2:
print(f'Move {i + 1} allowed between {source} and {auxiliary}')
--fcc-editable-region--
# initiate call from source A to target C with auxiliary B
move(NUMBER_OF_DISKS, 'A', 'B', 'C')