Python Program To Generate Pattern 50

Python Program To Generate Pattern 50

Write Python Program To Generate Pattern 50

# Write Python Program To Generate Pattern 50

n = 3
i = 1
k = 1

while(i <= n):
    
    j = n - i + 1
    while(j <= n):
        if k % 2 == 1:
            print('*', end = ' ')
        else:
            print('#', end = ' ')
        j = j + 1
        k = k + 1
    print('')
    i = i + 1

Output:

* 
# * 
# * #