Search⌘ K
AI Features

Challenge: Countdown

Explore how to apply Python for loops with the range function to perform a countdown from 5 to 1. Learn to print numbers in sequence and then output a final message using code inside and outside the loop. This lesson helps you understand loop iteration and sequence control, building confidence in basic Python programming.

We'll cover the following...

A for loop lets you run the same code once for each number in a sequence created by range().

Your task:

  1. Use a for loop to count down from 5 to 1

  2. Print each number as it counts down

  3. After the countdown finishes, print "Liftoff!"

💡 Things to keep in mind:

  • Code inside the loop runs multiple times

  • Code after the loop runs once

  • range() controls which numbers the loop uses

When you click Run, your output should look like a countdown followed by "Liftoff!".

Python
# Write your code here.