j = 0 jtemp = 1 for i in range(0, 10, 2): for j in range(jtemp, 20): if i == j: jtemp = j print('i:%s,j:%s,jtemp:%s' % (i, j, jtemp)) break print(i, j, jtemp)