Apr-06-2020, 09:23 AM
The indentation controls that. As line 7 goes back to the previous level of indentation, it marks itself as outside the previous scope.
You're only using one space for your indentation. While legal, it makes it much harder to see which statement is at what level. The recommendation is to use four spaces, which makes the statement levels more easily visible.
You're only using one space for your indentation. While legal, it makes it much harder to see which statement is at what level. The recommendation is to use four spaces, which makes the statement levels more easily visible.
second = 1 third = 1 while second < 100: while third < 50: print(third) third += 1 print(second) second += 1Lines 8 and 9 are outside all loops and would only be executed if the loop were ended (which it will not with the current code).