Explanations : When if condition returns true, the assert statement also returns true.
Hence AssertionError not generated.

This statement in itself is true. If i<j, then naturally i!=j would not give an assertion error. It is a correct, but highly cut down version of the program explanation. The program works like this:

On the first iteration of the inner loop, i=j=2, therefore, the assert statement is not reached. Second iteration, i!=j (i=2, j=3). Here, the assert is reached, and its condition is satisfied, and so on.

What the essence of the program is, is that i can have any value with respect to j. If it is equal to or greater than j, then the assert is not reached. If i is less than j, the assert is reached, but is true. Hence, if the "if" is true, the assert is true, which is what the explanation says.