Python Program to Print Square of Left Decrement Numbers Pattern

Write a Python program to print square of left decrement numbers pattern using for loop.

rows = int(input("Enter Square of Left Decrement Numbers Rows = "))

print("====The Square Left Decrement Numbers Pattern====")

for i in range(rows, 0, -1):
    for j in range(i, rows):
        print(j, end = ' ')
    for k in range(rows - i, rows):
        print(rows, end = ' ')
    print()
Python Program to Print Square of Left Decrement Numbers Pattern

This Python program displays the square pattern of decrement numbers from the left side using a while loop.

rows = int(input("Enter Square of Left Decrement Numbers Rows = "))

print("====The Square Left Decrement Numbers Pattern====")
i = rows

while(i >= 1):
    j = i
    while(j < rows):
        print(j, end = ' ')
        j = j + 1
    k = rows - i
    while(k < rows):
        print(rows, end = ' ')
        k = k + 1
    print()
    i = i - 1
Enter Square of Left Decrement Numbers Rows = 9
====The Square Left Decrement Numbers Pattern====
9 9 9 9 9 9 9 9 9 
8 9 9 9 9 9 9 9 9 
7 8 9 9 9 9 9 9 9 
6 7 8 9 9 9 9 9 9 
5 6 7 8 9 9 9 9 9 
4 5 6 7 8 9 9 9 9 
3 4 5 6 7 8 9 9 9 
2 3 4 5 6 7 8 9 9 
1 2 3 4 5 6 7 8 9