← Back to Recursion
Question 577
Recursive Countdown
Recursive Countdown
Complete countdown(n: int) -> None so it prints n, then n - 1, and so on down to 1, one number per line, and finally prints Done on its own line, using recursion instead of a loop. The base case (n is 0) already prints the final word; add the recursive case, which prints n and then calls the function with n - 1. Do NOT write a main block or any top-level test code; the tests construct the calls. Input: one integer n, no prompt, which the tests read and pass to your function.
Expected Output:
3 2 1 Done
= newline. The output ends with a newline — print one after the last line.
Hints2 available
Sign in to use hintsTopics:
Recursion
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.