mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix(curriculum): clarify steps wording hanoi puzzle (#53534)
This commit is contained in:
+2
-2
@@ -7,9 +7,9 @@ dashedName: step-3
|
||||
|
||||
# --description--
|
||||
|
||||
The puzzle starts with the disks piled up on the first rod, in decreasing size. You need to populate your first list with numbers representing the various disk sizes.
|
||||
The puzzle starts with the disks piled up on the first rod, in decreasing size, with the smallest disk on top and the largest disk on the bottom. You need to populate your first list with numbers representing the various disk sizes.
|
||||
|
||||
Instead of adding the items manually to the first list, generate a sequence of numbers from `3` to `1` by using the `range()` function and assign it to `rods['A']`.
|
||||
Instead of adding the items manually to the first list, generate a sequence of numbers counting down from `3` to `1` by using the `range()` function and assign it to `rods['A']`. Here, `3` represents the largest disk at the bottom of the pile and `1` represents the smallest disk at the top of the pile.
|
||||
|
||||
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.
|
||||
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ dashedName: step-16
|
||||
|
||||
At the end of this project, you will create a recursive solution to the Tower of Hanoi puzzle, but now you are going to explore an iterative approach to this problem.
|
||||
|
||||
Start by adding a `for` loop to your function that iterates through the number of moves and prints the current iteration number.
|
||||
Start by adding a `for` loop to your function that iterates through the `number_of_moves` and prints the current iteration number.
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ dashedName: step-53
|
||||
|
||||
# --description--
|
||||
|
||||
Although recursion could sometimes be less easy to understand, it gives you the power to create more concise code. In this case, you don't even need to differentiate between even and odd numbers of disks.
|
||||
Although recursion can sometimes be less easy to understand, it gives you the power to create more concise code. In this case, you don't even need to differentiate between even and odd numbers of disks.
|
||||
|
||||
Set `NUMBER_OF_DISKS` to `5` and check the output.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user