Skip to main content

Practice ยท 2 of 2

Build a String Across Iterations

Write function stars(rows) that returns a string with one line per row, each line containing row-count * characters followed by \n. stars(3) returns "**\n***\n***\n"โ€ฆ wait โ€” check the example: stars(3) is line 1: *, line 2: **, line 3: ***, each ending with \n. Rules: - Accumulate into one string and return it. - Line k has k stars.

Difficulty: beginner

Back to lesson: Practice: Loops: Repeating Work โ€” Practice