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
Post a Comment