You are viewing a single comment's thread. Return to all comments →
thickness = int(input()) #This must be an odd number c = 'H' W = thickness*thickness +4# unterschiedliche Gesamtbreite
for i in range(thickness): s=(2*i+1)*c print(s.center(2*thickness-1,' '))
for i in range(thickness+1): s = thickness*c print(s.center(2*thickness-1) + ' '*(2*thickness+1) + s.center(2*thickness-1))
for i in range((thickness+1)//2): s = 5*thickness*c print(s.center(5*thickness+2*(thickness//2),' '))
for i in range(thickness): s=(2*(thickness-i)-1)*c print(' '.center(2*thickness-1,' ')+' '.center(2*thickness+1,' ')+s.center(2*thickness-1,' '))
Seems like cookies are disabled on this browser, please enable them to open this website
Text Alignment
You are viewing a single comment's thread. Return to all comments →
Replace all __ with rjust, ljust or center.
thickness = int(input()) #This must be an odd number c = 'H' W = thickness*thickness +4# unterschiedliche Gesamtbreite
print(thickness)
Top Cone
for i in range(thickness): s=(2*i+1)*c print(s.center(2*thickness-1,' '))
Top Pillars
for i in range(thickness+1): s = thickness*c print(s.center(2*thickness-1) + ' '*(2*thickness+1) + s.center(2*thickness-1))
Middle Belt
for i in range((thickness+1)//2): s = 5*thickness*c print(s.center(5*thickness+2*(thickness//2),' '))
Bottom Pillars
for i in range(thickness+1): s = thickness*c print(s.center(2*thickness-1) + ' '*(2*thickness+1) + s.center(2*thickness-1))
Bottom Cone
for i in range(thickness): s=(2*(thickness-i)-1)*c print(' '.center(2*thickness-1,' ')+' '.center(2*thickness+1,' ')+s.center(2*thickness-1,' '))