Back
+10 XP
Concept

Modulo (%)

The percent sign `%` has nothing to do with sales discounts. It gives you the **remainder** left over after division:

python
print(10 % 3)  # Prints: 1 (3 goes in 3 times, 1 left over)
print(10 % 2)  # Prints: 0 (divides evenly, 0 left over!)

# 17. Modulo (%) The percent sign `%` has nothing to do with sales discounts. It gives you the **remainder** left over after division: ```python print(10 % 3) # Prints: 1 (3 goes in 3 times, 1 left over) print(10 % 2) # Prints: 0 (divides evenly, 0 left over!) ``` Coders use `number % 2` constantly to check if something is even (`0`) or odd (`1`).

Checkpoint

Why do programmers love `% 2` so much?

Practice

You have 7 pizza slices for 2 friends. Use `%` to see how many leftover slices you get to eat yourself.

Terminal
01
Tap code blocks below to assemble
Available Blocks