Text Alignment

  • + 0 comments
    thickness = int(input())
    if thickness%2 == 1:
      design = 'H'
    
      # top cone
      for i in range(thickness):
        print((design*i).rjust(thickness-1)+design+(design*i).ljust(thickness-1))
      
      # top pillar
      for i in range(thickness+1):
        print((design*thickness).center(thickness*2)+(design*thickness).center(thickness*6))
      
      # middle belt
      for i in range((thickness+1)//2):
        print((design*thickness*5).center(thickness*6))
      
      # lower pillar
      for i in range(thickness+1):
        print((design*thickness).center(thickness*2)+(design*thickness).center(thickness*6))
      
      # lower cone
      for i in range(thickness):
        print((((thickness-i-1)*design).rjust(thickness)+design+((thickness-i-1)*design).ljust(thickness)).rjust(thickness*6))
    
    else:
      print('enter odd number')