-
Notifications
You must be signed in to change notification settings - Fork 1
/
lets-warm-up.py
31 lines (31 loc) · 1.03 KB
/
lets-warm-up.py
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
def print_rangoli(size):
x=(size*2-1)*2-1
for i in range(size):
print('-'*((x-((i*2+1)*2-1))//2),end="")
for j in range(size,size-i-1,-1):
print(chr(96+j),end="")
if(j!=size-i):
print("-",end="")
if size-i+1<size+1:
print("-",end="")
for j in range(size-i+1,size+1):
print(chr(96+j),end="")
if(j!=size):
print("-",end="")
print('-'*((x-((i*2+1)*2-1))//2))
for i in range(size-2,-1,-1):
print('-'*((x-((i*2+1)*2-1))//2),end="")
for j in range(size,size-i-1,-1):
print(chr(96+j),end="")
if(j!=size-i):
print("-",end="")
if size-i+1<size+1:
print("-",end="")
for j in range(size-i+1,size+1):
print(chr(96+j),end="")
if(j!=size):
print("-",end="")
print('-'*((x-((i*2+1)*2-1))//2))
if __name__ == '__main__':
n = int(input())
print_rangoli(n)