← Back to Loops
Question 392
Number Pyramid Rows
Number Pyramid Rows
Read a height n and print n rows where row k shows the numbers 1 to k separated by spaces (so the third row is 1 2 3), using nested while loops with print(..., end=' ') for the numbers and a bare print() at the end of each row. Input: one integer of at least 1, no prompt.
Expected Output:
1 1 2 1 2 3
= newline. The output ends with a newline — print one after the last line.
Hints3 available
Sign in to use hintsTopics:
Loops
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.