The answersDownload the PDF
Worksheet

F1.10 Project: ask and drive

Programming basics · GCSE · about 25 min

BugBotLab
NameClassDate

What this lesson is about

Plan, build and test one program that asks, drives a square, plays notes and reports.

Questions 4 marks in all

  1. [1 mark]In the project, which of these is an output?

    1. AThe perimeter printed at the end
    2. BThe side length the user types
    3. CThe note the user types
    4. DThe constant SPEED
  2. [1 mark]What does this program print?

    side = float("12.5")
    print("perimeter:", 4 * side)
    print("area:", side * side)
  3. [1 mark]Why does the project convert the note with int but the side with float?

    1. AA side can be a fraction of a centimetre; a note is a whole number of hertz
    2. Bint is faster
    3. Ctone() only accepts text
    4. Dfloat cannot be used twice
  4. [1 mark]You test with a side of 10. What should the area be?

    1. A100
    2. B40
    3. C20
    4. D10

The task: ask and drive

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

SPEED = 50

# ask the two questions and convert the answers

# drive the square, a note at each corner

# print the perimeter and the area

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

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

Challenges

  1. Ask for the speed as well, as a third input.
  2. Make the robot play a different note at each corner: the note, then a note twice as high, then back.
  3. Drive a rectangle instead: ask for the width and the length, and report its perimeter and area.