CJCoding With Joseph
15free / daySign inCreate account

Step Countdown By Recursion

Complete count_down_by(n: int, step: int) -> None so it prints n, then n - step, then n - 2 * step and so on, one number per line, stopping before the first value that is 0 or below (that value is not printed), using recursion. The base case is written: a value of 0 or less prints nothing. Add the recursive case, which prints n and then calls the function with n - step and the same step. Do NOT write a main block or any top-level test code; the tests construct the calls. Input: two lines, n then step, no prompts, which the tests read and pass to your function.

Expected Output:

10
7
4
1

= newline. The output ends with a newline — print one after the last line.

Hints2 available
Topics:
Recursion
📥 Auto-Input:
10\n3\n
This input is automatically fed to your program's stdin
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.