Printing 'D' alphabet in star pattern with Python

 


To print 'C💖' 

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

For source code: Pattern source code on github


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

OUTPUT:


**** * * * ****


TUTORIAL:

0123
ROW=0****
ROW=1*
R0W=2*
ROW=3*
ROW=4****

   

Comments

Popular Posts