Build a times table machine
You will ask a loop to calculate a chosen times table. Predicting a few answers first helps you check the program rather than accept every displayed number.
- Code
- Explorer
- About 15 minutes
Grown-up needed: yes for choosing and supervising the coding environment
The film says 'Taz, on the Code tab'. In Taz today, choose Make, then Code, and pick Python.
What you need
- Paper and a pencil
- A grown-up-approved Python environment where the steps use code
- A grown-up
- Or the Maker Studio in Taz, in Python mode: open Taz, choose Make, then Code
The rule
Let the computer do every sum.
How to do it
- Choose a whole-number table such as seven.
- Write for n in range(1, 6): on the first line.
- Indent print(n, "x 7 =", n * 7) beneath it.
- Predict the first and last displayed sums.
- Run the code and compare all five results with multiplication.
- Change both sevens together to another chosen number.
Why it works
The loop supplies multipliers from one to five because the stopping value six is excluded. Multiplying n by seven calculates a new product on each turn. The quoted text is only a label, whereas n * 7 is the calculation. If you change the number in the label but leave the multiplication unchanged, the output can describe the wrong table. Checking a known answer exposes that mismatch. A short program still needs clear inputs and a meaningful check of its result.
Make it harder
- Extend the table to twelve multipliers.
- Print two different products per turn.
- Explain how an incorrect text label could hide a correct calculation.
Ask Taz
- Why does this range stop at five?
- Why is quoted text different from multiplication?
- Why should I check a result I already know?
The coding part of Taz is the Maker Studio.
For grown-ups
Choose and supervise the coding environment. The film names a Taz Code tab. In Taz today that is the Maker Studio: choose Make, then Code, and pick Python. Use ordinary sample words and numbers without personal details. Ask at dinner: “Which prediction did you check, and what change in the instructions would change that output?”
Taz is an AI and can be wrong, so stay close by. Read how safety works on Taz.
Show us yours
Film your hands and what you made, not your face or name. Ask a grown-up before posting anywhere else.
Questions parents ask
Can we begin without running code?
Yes. Write the predicted output on paper and trace the steps together. That gives you a comparison to use when a grown-up-approved Python environment is available. A prediction remains a prediction until you check the actual instructions and result.
What if an error appears?
Read the message with a grown-up and compare spelling, punctuation and indentation with the steps. Change one thing at a time and keep a note of what happened. An error is useful evidence about the instructions, not a judgement about the child.
Must we share the result?
No. Discussing the output at home is enough. Follow the privacy line above for optional online sharing.
More to try
See all Taz Challenges, or look through the science labs. One place for every why. Ask for early access at aitaz.com