-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAlphabet Rangoli.py
42 lines (30 loc) · 1014 Bytes
/
Alphabet Rangoli.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
32
33
34
35
36
37
38
39
40
41
42
def getMedian(value):
if value % 2 == 0:
return int(value/2)
else:
return int((value + 1)/2)
def print_rangoli(sizeNumber):
baseNumber = 97
horizontalValue = 0
verticalLine = (sizeNumber * 2) - 1
horizontalLine = (sizeNumber * 4) - 3
for a in range(verticalLine):
a += 1
if getMedian(verticalLine) > a:
chrVar = int(verticalLine/2)
else:
chrVar = int(verticalLine/2)
abcValue = chr(baseNumber + (chrVar))
x = int(horizontalValue/4)
for y in range(x):
y += 1
abcValue = chr(baseNumber + (chrVar) - y) + "-" + abcValue + "-" + chr(baseNumber + (chrVar) - y)
print(abcValue.center(horizontalLine-horizontalValue,'-'))
if getMedian(verticalLine) > a:
horizontalValue += 4
else:
horizontalValue -= 4
if __name__ == '__main__':
#n = int(input())
n = 5
print_rangoli(n)