Post

@clcoding Answer: 0 1 (on separate lines)
Solution: Let's see what `range` does.
If range is used with 2 integer arguments,
here is how it works:
range( start, stop )
gives an iterable from `start` up to `stop`.
The `stop` is NOT included in the iterable.
Thus, range(0, 2)
is 0, 1
+
English

@clcoding What would be range(0,0)?
It would be empty.
That's because the stop value (0) is not included in the range.
As the start and the stop values are the same, there are no values included in the range.
With that in mind, let's analyze the code.
+
English

@clcoding for i in range(0,2):
...
Here i iterates over the values in range(0,2), which are 0 and 1.
In the first iteration,
print(i)
prints
0
Next we have
for j in range(0,0):
...
range(0,0) is empty.
A for loop over an empty iterable executes 0 times, ie, is ignored.
+
English

@clcoding Thus, the inner for-loop is ignored.
That ends the first iteration of the outer loop.
In the second iteration of the outer loop,
i takes the value 1.
print(i)
this time prints
1
Again, the inner loop is ignored due to empty range.
Snippet ends here.
So, the net output:
0
1
English

