number = 9.3
while number % 0.5 != 0:
number -= 0.1
print number
-20.0
I expected number to end up leaving this while loop as 9.0, but somehow it has become -20.0. Note that if I change number to 9.2 it works just as I would expect and becomes 9.0. Some values work such as 9.0, 9.7 and some don't such as 9.4, 9.8. I have no clue why. By the way 9.8 becomes -1204.5 which is even more weird. I can't explain these results. Forgive me if I've missed something basic as I have only just begun to learn computer programming.