L1·Foundations
🔢Numbers & Operators
Arithmetic, integer vs float division, modulo.
mathintfloat//%**
§ 1Operators
+ - * / // % ** — plus, minus, times, true divide, floor divide, modulo, power.
§ 2True vs floor division
/ always returns float. // truncates toward negative infinity.
§ 3Precedence
** > unary - > * / // % > + -. Use parentheses when in doubt.
Example
1print(7 / 2) # 3.52print(7 // 2) # 33print(7 % 2) # 14print(2 ** 10) # 10245print(-7 // 2) # -4 (floor!)Try it live · Python runs in your browser
Loading playground…
Checkpoint quiz
Question 1 / 3
What is 10 // 3?