Programming basics · GCSE · OCR J277 2.2.1, AQA 8525 3.2.2, Edexcel 1CP2 6.2.2 · about 10 min
Instructions, one at a time, top to bottom. Running code and reading what comes back.
[1 mark]In what order does Python carry out the lines of a program?
[1 mark]What does this program print?
print("start")
print("end")
print("middle")start end middle
The lines run in the order they are written, so the output follows the order of the lines, not the meaning of the words.
[1 mark]What does from bugbot import * do?
[1 mark]A program prints "moving", then calls forward(50), wait(1) and stop(), then prints "stopped". When does "stopped" appear?
[1 mark]You press Run a second time. Where does the program start?
[1 mark]Which of these instructions make the robot do something, rather than just print?
Tick every answer that is true.
forward(50)stop()print("hello")wait(1)[1 mark]What is the difference between an algorithm and a 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("...")The hint students can ask for: Print three lines. One of them must be exactly: I am a BugBot
from bugbot import *
connect()
print('hello')
print('I am a BugBot')
print('bye')
Any program that meets the task's checks is marked correct in the simulator; this is one way, not the only way.