Execute statement every N iterations in Python
How about keeping a counter and resetting it to zero when you reach the wanted number? Adding and checking equality is faster than modulo. printcounter = 0 # Whatever a while loop is in Python while (…): … if (printcounter == 1000000): print(‘Progress report…’) printcounter = 0 … printcounter += 1 Although it’s quite possible … Read more