Python Program To Generate Pattern 39

Python Program To Generate Pattern 39

Write Python Program To Generate Pattern 39

# Write Python Program To Generate Pattern 39

i = 1
n = 3

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

Output:

3 2 1 
  2 1 
    1