Why am I getting strange results with simple arithmetic operations?
Python (like most programming languages but unlike many calculators) uses binary floating point numbers. Floating point numbers are fast and work well with modern computer architecture, but are subject to representation errors when converting between the internal binary format, and decimal numbers. Your strange results are probably a result of these representation errors. For more explanation, see: