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")[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("...")Plan your program here, then type it in and press Run.
print line before the first line? Try it and read what the robot says.