Operators
Maths, comparisons and logic — including the three operators beginners mix up.
Lesson 3 of 6 7 min
You will learn
- Use + − * / // % **
- Compare values with == != < >
- Combine conditions with and, or, not
Arithmetic
| Operator | Meaning | Example | Result |
|---|---|---|---|
| / | division (always a float) | 7 / 2 | 3.5 |
| // | floor division | 7 // 2 | 3 |
| % | remainder | 7 % 2 | 1 |
| ** | power | 2 ** 5 | 32 |
Python · try it
Output appears here · Ctrl + Enter to run
Checkpoint
1. What is 17 % 5?
2. How do you check if a number n is even?