Step 1 of 7

Step 1 · Read and run

Sharing out

17 sweets are shared between 5 children, and nobody gets a broken sweet. Each child gets 3, and there are 2 left over.

Python has an operator for each half of that answer:

  • // gives how many whole times it fits: the whole-number part of the division.
  • % gives what's left over: the remainder. It's said "mod", short for modulo.

In exam pseudo-code you'll see these written as DIV and MOD. Same ideas, different words.

Run it.

Run the program to carry on.
sweets.py

Output

Press Run to see what your program prints.