Problem 114599 · easy · Phase 01 Prerequisites & Setup

Countdown Ladder

lists · loops · range

A rocket launch display counts down from start to stop. Write countdown(start, stop) that returns a new list [start, start - 1, ..., stop] with both ends included. If start is smaller than stop, return an empty list.

Examples

Input:  start = 5, stop = 1
Output: [5, 4, 3, 2, 1]

Input:  start = 3, stop = 3
Output: [3]

Constraints

  • -1000 <= start, stop <= 1000

Goals

  • Build a list that counts downwards
  • Handle the case where there is nothing to count
Starting Python…