Embercode
✕
OperatorsQuick quiz

Division and modulo in Python

6 questions. Covers Floor division and modulo for negative numbers in Python.

Questions 1 to 5 of 6

  1. 1. What does this line print? ``python print(-9 // 4, -9 % 4) ``
  2. 2. What does this code print? ``python t = -11 print(int(t / 10) * 10, t // 10 * 10) ``
  3. 3. What does this code print? ``python import math size = 5 print(-1 % size, math.trunc(-1 / size)) ``
  4. 4. A ring has five slots numbered 0 to 4, and you stand in slot 0. Which expression gives the slot one step back, always from 0 to 4?
  5. 5. What happens when this line runs? ``python print(5 % 0) ``

5 question(s) left on this page.