Introduction
Welcome to the LabEx Space Academy's Python Loop Challenge! As a new recruit, you've been assigned to create a simple countdown program for rocket launches. This challenge will test your ability to use loops in Python, a crucial skill for automating repetitive tasks in space missions.
Rocket Launch Countdown
In this challenge, you will create a Python script that performs a countdown for a rocket launch.
Tasks
- Create a Python script named
countdown.pyin the/home/labex/projectdirectory. (Recommend to use WebIDE) - Write a program that does the following:
- Starts a countdown from 10.
- Prints each number in the countdown, one per line.
- After reaching 0, prints "Liftoff!"
Requirements
- The script must be named
countdown.pyand located in the/home/labex/projectdirectory. - Use a
forloop with therange()function to create the countdown. - Each number should be printed on a new line.
- After the loop completes, print "Liftoff!" on a new line.
- The script should run without any errors.
Example
After running the script, the output should look exactly like this:
10
9
8
7
6
5
4
3
2
1
0
Liftoff!
Summary
In this challenge, you have created a Python script that performs a countdown for a rocket launch. This exercise has reinforced your understanding of loops in Python, specifically using a for loop with the range() function. You've practiced creating a script that executes a repetitive task (counting down) and finishes with a specific action (printing "Liftoff!"). These fundamental skills in loop control are essential for many programming tasks you'll encounter in your journey as a space academy programmer.



