lesson

Countdown list

objective: debugging exercise · loops · hard
Task type: fix broken code

countdown_list(n) should return a list counting down from n to 1. Careful running this one — as written, it may never finish.

fix this code so it matches

countdown_list(3) is [3, 2, 1]. countdown_list(1) is [1]. countdown_list(0) is [].

  • Passes the visible tests
  • Passes the hidden tests (edge cases)
Go deeper

Lesson resources

Finding resources…
countdown_list.pyattempt 0
1
2
3
4
5
6