forked from hariom20singh/python-learning-codes
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdiamondPattern.py
More file actions
Latest commit
35 lines (34 loc) · 581 Bytes
/
Copy pathdiamondPattern.py
File metadata and controls
35 lines (34 loc) · 581 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
rows=5
i=1
whilei<=rows:
j=rows
whilej>i:
# display space
print(' ', end=' ')
j-=1
print('*', end=' ')
k=1
whilek<2* (i-1):
print(' ', end=' ')
k+=1
ifi==1:
print()
else:
print('*')
i+=1
i=rows-1
whilei>=1:
j=rows
whilej>i:
print(' ', end=' ')
j-=1
print('*', end=' ')
k=1
whilek<=2* (i-1):
print(' ', end=' ')
k+=1
ifi==1:
print()
else:
print('*')
i-=1