Getting started · Lesson 3 of 25
Numbers and operators
True and floor division, remainder, powers and round.
7 minutes3 games
| Operator | Meaning | Example |
|---|---|---|
| true division (always float) |
|
| floor division |
|
| remainder |
|
| power |
|
| absolute value / rounding |
|
Python
print(7 / 2, 7 // 2, 7 % 2, 2 ** 10)
print(round(3.14159, 2), abs(-8), max(4, 9, 2), min(4, 9, 2))
import math
print(math.sqrt(81), math.floor(4.7), math.ceil(4.2), math.pi)
print(10 / 3)
print(f"{10 / 3:.2f}")
print(1_000_000 + 1)What's the output?
print(17 // 5, 17 % 5)
What will this code print?
What's the output?
print(6 / 2)
What will this code print?
Exercise
You have 125 minutes. Print hours and remaining minutes as 2 h 5 min.
Expected output: 2 h 5 min
Python
minutes = 125
Learn more from
Played 0 of 3 games
Sign in to save your progress and earn XP.