In my program, I use the function for i in range...
and since the number of iterations is very high while the speed is relatively slow (cca "10 i per second"), I start the cycle with
if i % 1000 == 0:
print(i//1000)
showing the progress of program.
My question is, how complicated is this for Python? Does it actually try to divide i
by 1000 on every iteration? I do not believe it has tricks for these situations, the interpreter just blindly follows what is written. A human would look at the last 3 digits to check for divisibility (as computers use binary maths, I could try replacing with 1024).
How is this operation therefore complicated and costly? Is there an easier (not by coding, but by execution) solution?