Printing 'A' alphabet in star pattern with Python




 To print 'A' 

we will conclude that we have 6 rows and 5 columns and we will put some conditions with the if statement.

For source code: Pattern source code on github

for row in range(6):

    for col in range(5):
        if((col==0 or col==4) and row!=0) or ((row==3 or row==0) and (col>0 and col<4)):
            print("*",end="")
        else:
            print(end=" ")
    print()

OUTPUT:


*** * * * * ***** * * * *




Comments

Popular Posts