Python Program to print a kajukatri shape


n=7

spc=n*2+1

for row in range(1,n+1):

    x=''

    x=' '*spc 

    for col in range(1,row+1):

       x=x+str(col)+' ' 

   

for col in range(row-1,0,-1):

    x=x+str(col)+' '

    print(x)  

spc=spc-2 

spc=spc+4

for row in range(n-1,0,-1):

    x=''

    x=' '*spc 

    for col in range(1,row+1):

        x=x+'* '

        for col in range(row-1,0,-1):

           x=x+'* '

 print(x)

 spc=spc+2

Comments

Some popular posts

Python Program that computes the net amount of a bank account based a transaction log from console input.