diamond format '*' program in python

print(" Diamond Format \n")
val = eval(input('Enter the value  '))
k=val//2
j=0
for i in range(1,val,2):
 print(' '*k,end='')
 print('*'*i)print(" Diamond Format \n")
val = eval(input('Enter the value  '))
k=val//2
j=0
for i in range(1,val,2):
 print(' '*k,end='')
 print('*'*i)
 k=k-1
 j=i

j=j-2
k=2
#print(' ',j)
for j in range(j,0,-2):
 print(' '*k,end='')
 print('*'*j)
 k=k+1

 k=k-1
 j=i

j=j-2
k=2
#print(' ',j)
for j in range(j,0,-2):
 print(' '*k,end='')
 print('*'*j)
 k=k+1

Comments

Popular posts from this blog

Python Speech recognition for Mac OS X

Baby Step Giant Step Algorithm Python Code

Simple Automation using Python - Atomac in Mac OS X