You are doing floating point calculations, and I think this is the first time you see a floating point error.
This error is not dependant on Python but on the underlying implementation of a real number in the computer: unfortunately, many real numbers cannot be represented perfectly inside the machine since the memory can only handle a finite number of digits, so it truncates the number, effectively committing an error.
"But 0.05 doesn't have infinite digits", you will say. This would be true if computers worked in base 10, but they use base 2 - binary - numbers, so what has a finite digit representation in base 10 might have a periodic representation in binary.
For the sake of your program, you might as well reduce the precision of the numbers printed, since the error won't be noticeable in the scope of your problem (the error doesn't accumulate that much), in this way:
print("{.3f}".format(x))
I suggest looking it up on Google and visiting the links in other comments, it's a very interesting topic.
Since you make mistakes while doing this kind of calculations, absolutely avoid using float
types when doing important stuff, such as monetary contability! You should use an arbitrary precision type instead, like Decimal.