Python quick start · Robot club · about 10 min
Variables, arithmetic, and driving an exact distance instead of counting seconds.
[1 mark]What does this program print?
speed = 60
seconds = 1.5
print("drove at", speed, "for", seconds, "seconds")[1 mark]What does this program print?
cm_per_second = 18
seconds = 2
print("that should be about", cm_per_second * seconds, "cm")[1 mark]What does this program print?
speed = 60
speed = 25
print("speed is", speed)[1 mark]What does distance=20 mean in forward(50, distance=20)?
[1 mark]Do you need a wait() after forward(50, distance=20)?
[1 mark]What does this program print?
travelled_cm = 85
print("that is", travelled_cm / 100, "metres")[1 mark]The robot covers 18 cm every second. How many centimetres does it cover in 2.5 seconds? Give the exact number.
Drive 40 cm forward, then 45 cm to the right, and stop in the green zone. Use distance= rather than counting seconds, and give the two distances names at the top.
from bugbot import * connect() first = 40 # your second distance here forward(50, distance=first) stop()
Plan your program here, then type it in and press Run.
slow = 25 and run the journey at that speed. Is it closer to the middle of the zone?/ 100.