25 XP

12. Countdown

Beginner loops input

Your program reads one line holding a whole number n. Print the numbers from n down to 1, each on its own line, then Liftoff! on the last line.

If n is 0 or negative, there is nothing to count down: print only Liftoff!.

Example 1

Input3
Output3 2 1 Liftoff!
ExplanationOne line each for 3, 2 and 1, then Liftoff!

Example 2

Input0
OutputLiftoff!
ExplanationThere is nothing to count down from 0.

Constraints

  • n is a whole number from -100 to 100.
  • Print nothing else. A prompt inside input() is fine: the tests leave it out of the output.

Submit also runs 4 more tests you can't see.

Practises While Loops (lesson 14).

Code
# Read a whole number n. Print n, n - 1, ... down to 1,
# one per line, then "Liftoff!".
n = int(input())