Python arithmetic and operators

Operators combine values into expressions. Multiplication and division bind more tightly than addition; parentheses make an intended grouping explicit.

Python
price = 12
quantity = 3
total = price * quantity
print(total)
print(7 / 2, 7 // 2, 7 % 2)
assert -7 // 2 == -4
Read the full lesson