The answersDownload the PDF
Worksheet

F1.1 What a program is

Programming basics · GCSE · OCR J277 2.2.1, AQA 8525 3.2.2, Edexcel 1CP2 6.2.2 · about 10 min

BugBotLab
NameClassDate

What this lesson is about

Instructions, one at a time, top to bottom. Running code and reading what comes back.

Questions 7 marks in all

  1. [1 mark]In what order does Python carry out the lines of a program?

    1. ATop to bottom, one at a time
    2. BShortest line first
    3. CAll at the same time
    4. DIn any order it likes
  2. [1 mark]What does this program print?

    print("start")
    print("end")
    print("middle")
  3. [1 mark]What does from bugbot import * do?

    1. ABrings in the robot's commands, such as forward and stop
    2. BConnects to the robot
    3. CMakes the robot start moving
    4. DPrints the word bugbot
  4. [1 mark]A program prints "moving", then calls forward(50), wait(1) and stop(), then prints "stopped". When does "stopped" appear?

    1. AAfter the robot has stopped
    2. BBefore the robot moves
    3. CAt the same time as "moving"
    4. DIt never appears
  5. [1 mark]You press Run a second time. Where does the program start?

    1. AFrom the first line again
    2. BFrom where it stopped last time
    3. CFrom the last line
    4. DIt remembers and skips the lines it already ran
  6. [1 mark]Which of these instructions make the robot do something, rather than just print?

    Tick every answer that is true.

    1. Aforward(50)
    2. Bstop()
    3. Cprint("hello")
    4. Dwait(1)
  7. [1 mark]What is the difference between an algorithm and a program?

    1. AA program is an algorithm written in a language a computer can run
    2. BThey are two words for exactly the same thing
    3. CAn algorithm always runs faster
    4. DA program is only for robots

The task: your first program

Make the robot print three lines. One of them must be exactly I am a BugBot. The robot should not drive.

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

print("...")

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

QR code
Do it on the robot
www.bugbotlab.com/learn/f1-1-what-a-program-is/
The simulator checks it and tells you when it passes. Nothing to install, no account.

Challenges

  1. Print five lines that tell a very short story.
  2. Make the robot say "go" before it moves and "stop" after it stops.
  3. What happens if you put a print line before the first line? Try it and read what the robot says.