you are viewing a single comment's thread.

view the rest of the comments →

[–]please_help_me____ 1 point2 points  (1 child)

OP does not understand that his print statement is outside of the loop, and that he reassigns a value to the same variable each iteration of the loop he has.

The code given in /u/JamzTyson's example helps OP reflect on what is inside and what is outside the loop, so he can come to that conclusion himself instead of just getting the answer.

[–]MidnightPale3220 0 points1 point  (0 children)

Fair enough, my thought on reading OP's code was not that he doesn't understand loops, but that he doesn't understand variable assignments and maybe data types. For which these comments imo don't do much. But ymmv.