Back to Freecodecamp

Step 7

curriculum/challenges/english/blocks/learn-recursion-by-solving-the-tower-of-hanoi-puzzle/64dc916138dbe03bdfe6cec6.md

latest923 B
Original Source

--description--

The goal of the Tower of Hanoi is moving all the disks to the last rod. To do that, you must follow three simple rules:

  1. You can move only top-most disks
  2. You can move only one disk at a time
  3. You cannot place larger disks on top of smaller ones

Below your existing code, declare an empty function named move. Later on, you will use that function to move the disks between the rods. For now, to avoid errors, use the pass keyword inside the function body.

--hints--

You should declare an empty function named move. Remember to use the pass keyword inside the function body with the correct indentation.

js
({ test: () => {
		assert(runPython(`
        import inspect
        inspect.isfunction(move)
    `))
	} 
})

--seed--

--seed-contents--

py
rods = {
    'A': list(range(3, 0, -1)),
    'B': [],
    'C': []
}
--fcc-editable-region--

--fcc-editable-region--