Number Triangle Pattern
Easy 20 XPPatternsLoops
Commonly asked at Zoho, TCS
Read n and print a triangle of numbers: row i contains the numbers 1 to i separated by spaces.
- Input
- One integer n.
- Output
- n lines.
Sample 1
Input
4
Output
1 1 2 1 2 3 1 2 3 4
Read input with input() (no prompt message) and print only the answer. Run tries the Input box; Submit checks all test cases.
Output Loading Python (first time takes a few seconds)
Press Run to see the result here.The solution unlocks after 3 submissions.