Skip to content

Commit 9b02870

Browse files
text align added
1 parent cf1f07e commit 9b02870

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

Strings/Text Alignment/Solution.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Replace all ______ with rjust, ljust or center.
2+
3+
thickness = int(input()) # This must be an odd number
4+
c = 'H'
5+
6+
# Top Cone
7+
for i in range(thickness):
8+
print((c * i).rjust(thickness - 1) + c + (c * i).ljust(thickness - 1))
9+
10+
# Top Pillars
11+
for i in range(thickness + 1):
12+
print((c * thickness).center(thickness * 2) + (c * thickness).center(thickness * 6))
13+
14+
# Middle Belt
15+
for i in range((thickness + 1) // 2):
16+
print((c * thickness * 5).center(thickness * 6))
17+
18+
# Bottom Pillars
19+
for i in range(thickness + 1):
20+
print((c * thickness).center(thickness * 2) + (c * thickness).center(thickness * 6))
21+
22+
# Bottom Cone
23+
for i in range(thickness):
24+
print(((c * (thickness - i - 1)).rjust(thickness) + c + (c * (thickness - i - 1)).ljust(thickness)).rjust(thickness * 6))

0 commit comments

Comments
 (0)