I'm doing some stuff on several lines of data. This takes a long time, and I would like to show the percentage of progress.
So I have the following code:
for y in range(0, height):
if (y * 100 / height).is_integer():
print("... ", int(y * 100 / height), "%")
height
is the number of lines that need to be processed.
However, somehow this code doesn't print the correct percentages. If height is 100 it works fine. For 4050 it prints every 2 percentages (0%, 2%, 4%, ...). For 2025 it prints every 4 percentages...
Why does this happen? And how can I fix it?