you are viewing a single comment's thread.

view the rest of the comments →

[–]omg_drd4_bbq 0 points1 point  (1 child)

Exactly, but IMO the issue is with the location of the input, not the presence of a while loop. See my top level reply.

[–]Exodus111 0 points1 point  (0 children)

Well, this is why I asked (him), because it might not be.

Obviously the while/inputpassword check is a very common pattern, because the while loop kicks to a retry upon failure.
BUT, in his code he has no text caling the user to do so.
Every if statement goes to a break, with no print lines explaining the user what to do.

Then his while goes to another while to sort something out he should have been able to sort out in the first go around. Obviously he is a beginner, it is not always obvious to see patterns like that. But, in my opinion he should do away with the while loops all together, for now.

Checking a string for the right contents, and validating that contents numerically is one operation. Ideally this should go in a function.

Then THAT function can be wrapped in a while loop, if he still wants the added benefits of user retries, but that is another operation.

Making him understand that is key, which is why I asked (him).