Python Program To Generate Pattern 9

Python Program To Generate Pattern 9

Write Python Program To Generate Pattern 9

# Write Python Program To Generate Pattern 9

n = 3
i = 1

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

Output:

    * 
  * * 
* * *