Do you know why interpreter is making mistake during calculation 7/100 * 100 - 7?

Thx for any hints. I’m new in Python and I can find any good explanation at the moment ;(

This question is a bit ambiguous, but I suspect you’re running into floating point arithmetic. This isn’t a mistake so much as something that you need to be aware of whenever you do arithmetic on computers.

See 15. Floating Point Arithmetic: Issues and Limitations — Python 3.11.0 documentation

Just like how in base 10 1 / 6 is not exactly equal to 1.6667e-1 but the latter is the closest we can get to writing down 1 / 6 with a finite number of decimal places, in base 2 1.1eb851eb851ecp-4 (try (7 / 100).hex() in your interpreter) is as close as your computer can get to representing 7 / 100 in only 64 bits; notice how the 1eb85 part repeats, but the last repetition is cut off at ec rather than eb due to rounding. When you then multiply by 100, that tiny rounding error is still there making the value just a bit larger than 7, and then subtracting 7 leaves you with just the rounding error rather than 0.

See the FAQ.

This is unavoidable behaviour that occurs pretty much with every programming language, and even with ordinary calculators. You probably remember from school doing calculations and getting (say) 1.99999999999 instead of 2, or 5.000000000071 instead of 5. Same thing.