Arithmetic operators let you perform mathematical calculations in Python, just like a calculator. Python supports seven arithmetic operators: addition (+), subtraction (−), multiplication (*), division (/), floor division (//), modulus (%), and exponentiation (**). Division always returns a float, while floor division drops the decimal and returns an integer. The modulus operator gives the remainder after division, and exponentiation raises a number to a power.
Key Points
+ adds two numbers: 5 + 3 → 8.
- subtracts: 10 - 4 → 6.
* multiplies: 3 * 7 → 21.
/ divides and always returns a float: 10 / 3 → 3.333…
// floor-divides (drops the decimal): 10 // 3 → 3.
% gives the remainder (modulus): 10 % 3 → 1.
** raises to a power (exponentiation): 2 ** 4 → 16.