Print alphabet pattern ‘J’ in Python

To print the alphabet pattern ‘J’ in Python

Code:

for row in range(7):
    for col in range(5):
        if row == 0:
            print('*', end=' ')
        elif (row in range(1, 5)) and (col == 2):
            print('*', end=' ')
        elif (row == 5) and (col == 0 or col == 2):
            print('*', end=' ')
        elif (row == 6) and (col == 1):
            print('*', end=' ')
        else:
            print(' ', end=' ')
    print()

Leave a comment