Times table
Prints the multiplication table 1 to 10. Teaches nested loops and aligning text.
Open in Tokbit Level: Intermediate. 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 a multiplication table. Teaches nested loops."""
for i in range(1, 11):
row: str = ""
for j in range(1, 11):
s: str = str(i * j)
# Pads with spaces on the left so the numbers line up.
while len(s) < 4:
s = " " + s
row = row + s
print(row)
Follow-up tasks
Tasks in which you change the example (with a model solution):