In this python program, we will learn how to print the right-angled triangle star pattern.
Here is the source code of the program to print the right-angled triangle star pattern.
# Python Program to Print the Right Angled Triangle
# Star Pattern Using For Loop
# Take the Input From the User
rows = int(input("Enter the Total Number of Rows: "))
# Print the Output
print("Right Angled Triangle Star Pattern")
for i in range(1, rows + 1):
for j in range(1, i + 1):
print('*', end = ' ')
print()
Enter the Total Number of Rows: 5
Right Angled Triangle Star Pattern
*
* *
* * *
* * * *
* * * * *
# Python Program to Print the Right Angled Triangle
# Star Pattern Using While Loop
# Take the Input From the User
rows = int(input("Enter the Total Number of Rows: "))
# Print the Output
print("Right Angled Triangle Star Pattern")
i = 1
while(i <= rows):
j = 1
while(j <= i):
print('*', end = ' ')
j = j + 1
i = i + 1
print()
Enter the Total Number of Rows: 6
Right Angled Triangle Star Pattern
*
* *
* * *
* * * *
* * * * *
* * * * * *
Comments