Python Program To Generate Pattern 45

Python Program To Generate Pattern 45

Write Python Program To Generate Pattern 45

# Write Python Program To Generate Pattern 45

n = 3
i = 1

while(i <= n):
    
    k = i
    while(k < n):
        print(' ', end='')
        k += 1
    
    j = n
    while(j >= n - i + 1):
        print(j, end = ' ')
        j = j - 1
    print('')
    i = i + 1

Output:

  3 
 3 2 
3 2 1