Entering row 2 and column 2 will give you row 3 and column 3 because of 0-based indexing, but the lessons don't correct for this or talk about it.
Because at this point in the track it is moot. We expect what you got.
Moot? My point is that they actually instruct you to write a program that gives the wrong output, not that the user can't figure it out. That's just kind of clumsy.
The author is not considering whether or not the user will intuitively reach for
1..N, and must be of the assumption that everyone by this stage will understand zero-indexing. That's what makes it moot.
If you, like many others before you are insistent upon letting the user enter counting numbers, them tell them to.
guess_row = int(raw_input("Enter a row number (1..5): ")) - 1
In the above the user is sufficiently instructed on expected inputs, and the program adjusts that input to match the reality of the code.
Well yes, I'm not asking for instructions on how to subtract one from a value; I'm just opining that in a total beginner programming course of this sort the author ought to simply consider that. As you can see in some previous posts, it does needlessly confuse the occasional person.
What's more confusing is why people are making this an issue, especially given that this is a very old course with pretty clear instructions.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.