Skip to the workspace
Pebellslearn by building

Python syntax & reference

Find the form you need, compare how it behaves, and open the complete explanation when you need more depth.

Python 3.10+ syntax; individual entries identify newer features. Browser exercises use the configured Python runner.

2 matching syntax entries

Division, remainder and powers

Learn in depth →

Numeric operators calculate values; floor division rounds the quotient down.

a / b; a // b; a % b; a ** b

Example

print(7 / 2, 7 // 2, -7 // 2, 7 % 2, 2 ** 3)

Result

3.5 3 -4 1 8

Watch for: Division by zero raises ZeroDivisionError. Binary floating point cannot represent every decimal exactly.

Practise this topic →

Equality, identity and membership

Learn in depth →

Equality compares values, identity compares objects, and membership asks whether an item is present.

a == b; a is b; item in container

Example

a = [1]
b = [1]
print(a == b, a is b, 1 in a)
print(1 < 2 < 3)

Result

True False True
True

Watch for: Use is None for the singleton None. Do not use is to compare numbers or strings.

Practise this topic →
Complete explanation index (91 lessons indexed)

Operators & Math

Technical sources and review date

Original Pebells examples. Reviewed 2026-10-28.

Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.