Python Program To Generate Pattern 8

Python Program To Generate Pattern 8

Write Python Program To Generate Pattern 8

# Write Python Program To Generate Pattern 8

n = 3
i = 1

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

Output:

* * * 
 * * 
  *