easy +5 pts

Count down from n

Generate a list of integers from n down to 1 in descending order.

Write a function `count_down(n)` that takes a non-negative integer `n` and returns a list of integers from `n` down to `1` in descending order. If `n` is 0, return an empty list.

Constraints

0 ≤ n ≤ 1000

Example

>>> count_down(5)
[5, 4, 3, 2, 1]
>>> count_down(1)
[1]
>>> count_down(0)
[]
5 points ~5 min

Recent Submissions

No submissions yet — hit Run Tests to try!

Hints

Use the built-in `range` function with a negative step.
`range(n, 0, -1)` produces numbers from n down to 1.
Convert the range result to a list.
Python 3
All tests passed!
Test Results
Press Ctrl+Enter or click Run Tests to execute your code.