# basics variables

Floor Division and Remainder

Two operators are especially useful for splitting things evenly:

  • // floor division — divides and drops anything after the decimal point
  • % modulo — gives back the remainder left over
print(17 // 5)
print(17 % 5)

prints:

3
2

(17 split into groups of 5 makes 3 whole groups, with 2 left over.)

Your turn: read two numbers, total and groups. Print how many whole groups fit (total // groups), then print how many are left over (total % groups).

💡 need a hint?

pyb-var-floor-mod.py🔒 given lines are locked — write your code in between
loading...