Created
June 14, 2017 21:23
-
-
Save vijayanandrp/e6c2a49f84fa06be4bdc49628426b52b to your computer and use it in GitHub Desktop.
diamond format '*' program in python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment