Write a program to print a parallelogram pattern with * characters. The size N represents the length (the number of * characters in each line)& breadth ( the number of lines) of the parallelogram.
The slope of the parallelogram T represents the number of extra spaces a line should have in the beginning compared to its next line. The last line of the pattern does not have any spaces in the beginning.
Explanation:
Given N=3 and T=2
Each line should have 3 star(*) characters.
The last line should have 0 spaces at the beginning.
Each line has 2 extra spaces characters when compared to its next line.
Sample Input1
2
2
Sample Output1
**
**
Sample Input2
3
2
Sample Output2
***
***
***
symbol = "*"
space = " "
N = int(input("N = "))
T = int(input("T = "))
k = N*T
for i in range(N):
k -= T
print(space*k, end='')
for i in range(N):
print(symbol, end='')
print()
Comments
Leave a comment