Write a Python program that uses a while loop to print a right-angled triangle of height ‘n’, where ‘n’ is an input from the user.
Example 1:
Input: 5
Output:
*
**
***
****
*****
Example 2:
Input: 3
Output:
*
**
***
Consider how the number of asterisks relates to each row of the triangle. You could use nested loops to solve this problem.
n = int(input(“Enter triangle height: “))
i = 1
while i <= n:
print(‘*’ * i)
i += 1
NOTEOwing to browser caching, any code input into the Trinket IDE might carry over across page refreshes or when transitioning between different questions. To commence with a clean slate, either click on the 'Reset Button' found within the IDE's Hamburger icon (☰) menu or resort to using Chrome's Incognito Mode.