-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtextAlignment.py
More file actions
31 lines (21 loc) · 830 Bytes
/
textAlignment.py
File metadata and controls
31 lines (21 loc) · 830 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
from __future__ import print_function, division
char = 'H'
space = ' '
def text_align(width):
lines = []
for n in range(width):
lines.append((char*(n*2+1)).center(width*2-1, space))
offset = space*(width*4 - (width*2-1))
for n in range(width+1):
lines.append((char*width).center(width*2-1, space) + offset + (char*width).center(width*2-1, space))
for n in range((width+1)//2):
lines.append((char*width*5).center(width*6, space))
for n in range(width+1):
lines.append((char*width).center(width*2-1, space) + offset + (char*width).center(width*2-1, space))
for n in reversed(range(width)):
lines.append(space*(width*4) + (char*(n*2+1)).center(width*2-1, space))
return lines
def main():
T = int(input())
print('\n'.join(text_align(T)))
main()