Given an integer number N as input. Write a program to print the right-angled triangular pattern of N lines as shown below.
Note: There is a space after each asterisk ( * ) character
In the given example the solid right angled triangle of side 4. Therefore, the output should be.
* * * *
* * *
* *
*
num = int(input("Enter a positive integer: "))
for i in range(1,num + 1):
for j in range(1,num + 1):
if j < i:
print(' ', end = ' ')
else:
print('*', end = ' ')
print()
Enter a positive integer: 4
* * * *
* * *
* *
*
Comments
Leave a comment