Languages for robots
Answers are for parents and teachers.
1
Write three differences between block-based and text-based languages.
For example: blocks are dragged and text is typed; text languages have syntax rules and block languages do not; text languages are more powerful and block languages are mostly for learning.
2
Find the two errors in the program and write the correct lines.
Python
1print("Start) 2prnt("End")
Line 1 is missing the closing quotation mark, which is a syntax error: print("Start"). Line 2 has the misspelt word prnt, which the computer does not know: print("End").
3
Write Python that matches these blocks and say what it prints.
The program is a = 1, for i in range(3): a = a + 4. After the loop a is 13, so print(a) prints 13.
4
What does this program print?
Python
1n = 20 2for i in range(3): 3 n = n - 5 4print(n)
n goes 15, 10, 5 and the loop ends, so it prints 5.
5
(if you have a computer or tablet) With an adult, type one print line in a Python tool and run it. Then make one deliberate mistake and read the error message.
Check that the program prints the text. The mistake could be a missing bracket or a quote, and the error message names the line.