The answersDownload the PDF
Worksheet

F1.9 Arithmetic operators

Programming basics · GCSE · OCR J277 2.2.1, AQA 8525 3.2.3, Edexcel 1CP2 6.5.1 · about 15 min

BugBotLab
NameClassDate

What this lesson is about

The seven operators, integer division and remainder, and the order they work in.

Questions 11 marks in all

  1. [1 mark]What does this program print?

    print(20 / 5)
  2. [1 mark]What does this program print?

    print(10 // 4)
    print(10 % 4)
  3. [1 mark]What is the value of 2 + 3 * 4?

  4. [1 mark]What is the value of (2 + 3) * 4?

  5. [1 mark]Which of these is a float?

    1. A4.0
    2. B4
    3. C-3
    4. D100
  6. [1 mark]x % 2 is 0 when x is even. What is it when x is odd?

    1. A1
    2. B0
    3. C2
    4. Dx
  7. [1 mark]What does this program print?

    print(round(10 / 3, 2))
  8. [1 mark]What is the value of 17 // 5?

  9. [1 mark]What is the value of 17 % 5?

  10. [1 mark]What does this program print?

    print(2 * 3 ** 2)
  11. [1 mark]What does this program print?

    seconds = 135
    print(seconds // 60, seconds % 60)

The task: robot maths

Using only the numbers 17 and 5 in your calculations, print four lines: divide: 3.4, DIV: 3, MOD: 2 and power: 25 (the power is 5 to the power 2). Work each one out with an operator; do not type the answers. The robot must not drive.

# the two lines every program starts with: the commands, then the robot
from bugbot import *
connect()

print("divide:", 17 / 5)

Plan your program here, then type it in and press Run.

QR code
Do it on the robot
www.bugbotlab.com/learn/f1-9-arithmetic-operators/
The simulator checks it and tells you when it passes. Nothing to install, no account.

Challenges

  1. Print the distance ahead in metres instead of centimetres.
  2. Ask for a number of seconds with input and print it as minutes and seconds.
  3. Try -7 // 2 and -7 % 2. The answers surprise most people. Work out the rule Python is using.