Answer to Question #238167 in Python for C N Manjula

Question #238167
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.

Input: 2 2
Output: **
**
Input: 3 2
Output: ***
***
***
1
Expert's answer
2021-09-16T11:37:00-0400
N, T = map(int, input().split())
side = '*' * N
for i in range(N):
    space_line = ' ' * T * (N - i - 1)
    print(space_line, side, sep='')

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS