-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtext_alignment.py
More file actions
45 lines (33 loc) · 1.1 KB
/
text_alignment.py
File metadata and controls
45 lines (33 loc) · 1.1 KB
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
43
44
45
def createTriangle(thickness):
flag = 1
width = thickness - 1
totalW = width + thickness
array = []
for i in range(0, thickness):
array.append(('H'*flag).center(totalW))
flag+=2
return array
def triangle(thickness):
array = createTriangle(thickness)
for i in range(len(array)):
print(array[i])
def reversedTriangle(thickness):
array = createTriangle(thickness)
for i in range(len(array)):
print((array[::-1][i]).rjust(thickness*6-1))
def logo(thickness):
#Up side of the H
for i in range(thickness+1):
print(('H'*thickness).center(thickness*2)+('H'*thickness).center(thickness*6))
#Center of the H
for i in range(int((thickness+1)/2)):
print(('H'*thickness*5).center(thickness*6))
#Down side of the H
for i in range(thickness+1):
print(('H'*thickness).center(thickness*2)+('H'*thickness).center(thickness*6))
def printAll(thickness):
triangle(thickness)
logo(thickness)
reversedTriangle(thickness)
thickness = int(input())
printAll(thickness)