Parallelogram
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
The input contains an integer
The output should have
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 space characters when compared to its next line.
Sample Input 1
2 2
Sample Output 1
**
**
Sample Input 2
3 2
Sample Output 2
***
***
***
#Python 3.9.5
def solidRhombus(rows, spaces_step):
print ("\nSolid Rhombus:")
for i in range (1,rows + 1):
# Print trailing spaces
for j in range (1,rows - i + 1):
print (end = spaces_step*" ")
# Print stars after spaces
for j in range (1,rows + 1):
print ("*",end="")
# Move to the next line/row
print()
# driver program
if __name__ == "__main__":
L = input().split()
rows = int(L[0])
spaces_step = int(L[1])
solidRhombus(int(rows), int(spaces_step))
Comments
Leave a comment