Python operators
Arithmetic to walrus — every operator with its exact semantics. Entries with a LIVE pill have an editable in-browser demo.
Numbers in, numbers out — plus the true/floor division split and Python’s divisor-signed modulo.
LIVE
+
a + b
Addition — and sequence concatenation.
LIVE//
a // b
Floor division — rounds toward negative infinity, not zero.
LIVE%
a % b
Modulo — the remainder, with its sign following the divisor.
LIVE*
a * b
Multiplication — and sequence repetition.
LIVE**
a ** b
Exponentiation — right-associative, and ^ is NOT this.
LIVE-
a - b
Subtraction — and set difference.
LIVE/
a / b
True division — always returns a float, even for ints.