Challenge: Countdown
Explore how to write a Python program that counts down from five to one and then prints a message to simulate liftoff. This lesson helps you understand loops and output in Python, developing your skills in controlling program flow and creating interactive scripts.
We'll cover the following...
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:
Use a
forloop to count down from 5 to 1Print each number as it counts down
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!".