Programming basics · GCSE · OCR J277 2.2.1, AQA 8525 3.2.7, Edexcel 1CP2 6.4.1 · about 10 min
Print text and numbers, several things at once.
[1 mark]What does this program print?
print("one", "two", "three")one two three
Commas between things in one print put a single space between them.
[1 mark]What does this program print?
print("a" "b")ab
Two strings side by side with no comma are glued together into one string, so there is no space.
[1 mark]What does this program print?
print("above")
print()
print("below")above below
print() with nothing inside prints an empty line.
[1 mark]What is the difference between 42 and "42"?
[1 mark]You want to print: BugBot's LED is green. Which line works?
print("BugBot's LED is green")print('BugBot's LED is green')print(BugBot's LED is green)print("BugBot's LED is green)[1 mark]What does this program print?
print("the answer is", 6 * 7)the answer is 42
The calculation is worked out first, and print shows the text and the number with a space between them.
Print exactly three lines:
- Hello from BugBot
- 1 2 3 (three numbers, one print, commas between them)
- BugBot BugBot BugBot (the word three times from one print)
# the two lines every program starts with: the commands, then the robot
from bugbot import *
connect()
print("Hello from BugBot")The hint students can ask for: Three lines, each from one print: the greeting, the numbers 1 2 3 separated by commas in the print, and the word BugBot three times.
from bugbot import *
connect()
print('Hello from BugBot')
print(1, 2, 3)
print('BugBot', 'BugBot', 'BugBot')
Any program that meets the task's checks is marked correct in the simulator; this is one way, not the only way.