Here is the code:
for i in range(12):
for j in range(8):
if i == j:
break
print i
print j
My thought is: at first i is equal to 0 and j is equal to 0. This matches with the
i == j
condition and so
break
would be triggered. It would then exit the innermost for loop. So the value of j would be 0. Since the outer for loop doesn't get exited, i would continue to loop through all the elements in range(12) and at the end i would be assigned 11. So when I printed the values of i and j, they would be 11 an d 0 respectively.
However the result was:
i = 11 and j == 7
I would like to know which part in my argument above goes wrong.