Problem 156307 · easy · Phase 01 Prerequisites & Setup

Launch Countdown

loops · range · lists

Write countdown(n) that returns a list counting down from n to 1, followed by the string "Liftoff!". If n is 0, the list contains only "Liftoff!".

Examples

Input:  n = 3
Output: [3, 2, 1, 'Liftoff!']

Input:  n = 0
Output: ['Liftoff!']

Constraints

  • 0 <= n <= 10**4

Goals

  • Count downwards with range() and a negative step
  • Build a list inside a loop and add a final item after it
Starting Python…