Taz

All Taz Challenges

Code a rocket countdown

You will count down from five and then print a final message. A negative step changes the direction, while the stopping value decides which numbers appear.

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

The rule

It must count backwards.

How to do it

  1. Write for n in range(5, 0, -1): on the first line.
  2. Indent print(n) beneath it.
  3. Write print("Lift off") on a third line without indentation.
  4. Predict the complete output before running.
  5. Run it and check that one appears before the final message.

Why it works

The three range arguments specify a starting value, an excluded stopping value and a step. Starting at five with a step of minus one gives five, four, three, two and one before reaching the excluded zero. The indented print instruction runs during each turn. The final unindented instruction runs after the loop has finished. Changing the step to minus two skips values, so that change also affects the last printed number rather than simply making the same countdown faster.

Make it harder

Ask Taz

Ask Taz

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