Post

@PythonPr Undefined " j" I mean take a closer look at it
English

@PythonPr Am i the only one who sees an indentation error? Shouldn't the 'print' statement be nested within the inner loop?
English

@PythonPr In this snippet, break only exits the inner loop. So, when loop 1 gives 0 (for i) and 0 (for j), the inner loop breaks, those values are printed, and the outer loop begins again. So,
0 0
1 1
2 2
English

@PythonPr 0 0
1 1
2 2
as loop break when I and j are equal it will exit inner loop immediately ans print the result in outer loop. Keep doing it till all iterations completes in outer loop
English

@PythonPr Output is:
0, 0
1, 1
2, 2
Detailed Explanation:
Loop begins from outer-loop, captures the value for i (0) then moves to inner-loop, captures the value for j(0), the test the condition (is i == j --> 0==0) condition is True so the inner-loop is exited and the print(i,j) is
English

@PythonPr Answer: 0 0 / 1 1 / 2 2
break only escapes one loop.
Indentation tells you exactly which one.
English

@PythonPr Correct output:
Python
0 0
1 1
2 2
break only exits the inner loop.
For each i, the inner loop stops when j == i, then print(i, j) runs.
English

@PythonPr I feel like this should give an out of scope error but the result is:
0 0
1 1
2 2
English









