Rainbow
Prints lines in all screen colours. Teaches the for loop and how to change the text colour, the background and where you write.
Open in Tokbit Level: Beginner. Free in the browser, nothing to install, no account needed.
Run the example in Tokbit and step through it: before each step say what will happen and check it in the Variables panel. Then change it your way.
Flowchart
Python program
The same program as Python code. In Tokbit you see it when you switch from Diagram to Python above the flowchart.
"""Prints the 15 C64 colours. Teaches text colour and a loop."""
# Tokbit screen functions, not in plain Python:
from tokbit import cls, at, color, background, border, BLACK, WHITE
background(BLACK)
border(BLACK)
cls()
# Colour 0 is black and would not show on a black background.
for c in range(1, 16):
color(c)
print("Colour", c)
color(WHITE)
at(12, 20)
print("*** RAINBOW ***")
Follow-up tasks
Tasks in which you change the example (with a model solution):