CJCoding With Joseph
15free / daySign inCreate account

Star Triangle By Recursion

Complete print_stars(n: int) -> None so it prints a triangle of n rows where the first row holds one star and each row holds one more star than the row above it, using recursion. The base case is written: zero rows prints nothing. Add the recursive case: call the function with n - 1 FIRST, so the shorter rows come out before this one, then print a row of n stars built with string repetition, "*" * n. 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:

*
**
***
****

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

Hints2 available
Topics:
Recursion
📥 Auto-Input:
4\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.