Back to Practice
#0212
Right Triangle Star Pattern
EasyPython15 min10 XP
Problem
For n, return a list of strings where the first row has one star and each next row has one more star.
Why This Matters
Star patterns train loop boundaries and string multiplication without needing complex algorithms.
Function Signature
def right_triangle_stars(n):
Examples
Example 1
Inputn = 4
Output["*", "**", "***", "****"]
Row i contains exactly i stars.
Constraints
- Return the exact requested value.
- Handle small edge cases cleanly.
- Prefer readable Python over clever shortcuts.
CodePython
Visible browser tests run here when available.
Testcases1 visible / 3 hidden categories
Core example
Inputn = 4
Expected["*", "**", "***", "****"]
Row i contains exactly i stars.
Hidden Test Categories
n = 0n = 1larger n