-
-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lesson 17. Introduction to For Loops: Explain why we need to subtract 1 to board_size.x #955
Labels
content
Issues with the lessons, practices, including their code examples
Comments
sin3to1faith
added
the
content
Issues with the lessons, practices, including their code examples
label
May 13, 2024
sin3to1faith
changed the title
Lesson 17 "Using a for loop instead of a while loop"
Lesson 17. Introduction to For Loops: "Using a for loop instead of a while loop"
May 13, 2024
sin3to1faith
changed the title
Lesson 17. Introduction to For Loops: "Using a for loop instead of a while loop"
Lesson 17. Introduction to For Loops: "Using a for loop instead of a while loop" contains mistakes.
May 13, 2024
Thanks for taking the time to give feedback. In this case, the lesson's correct. To move to the end of a grid of 5 cells, if you're on cell 1, you need to move 4 times. range(5) (the size of the array) would produce 5 numbers (0, 1, 2, 3, 4) and make you move 5 steps, so 1 cell past the limit. That's why you need to subtract 1 from the board size. I'm changing the issue title to add a new sentence about that to the lesson. |
NathanLovato
changed the title
Lesson 17. Introduction to For Loops: "Using a for loop instead of a while loop" contains mistakes.
Lesson 17. Introduction to For Loops: Explain why we need to subtract 1 to board_size.x
May 13, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the second example of this section's lesson,
board_size.x - 1
is used as a parameter in therange()
function when it should beboard_size.x
asvoid range(length: int)
creates a list of numbers from 0 to length - 1.This mistake can be seen again in the first practice lesson 'Using a for loop to move to the end of the board'. The user must recreate the mistake shown in this lesson's example to succeed in the practice lesson.
The text was updated successfully, but these errors were encountered: