Skip to main content
-1 byte by emanresu A.
Source Link
squareroot12621
  • 1.2k
  • 1
  • 3
  • 18

Python 3.8 (pre-release),  158   144  143 143  142 bytes

-14 bytes by Unrelated String.
-1 byte2 bytes by emanresu A.

t=lambda s:(r:=len(s)//2)and[l.center(r*2+1r-~r)for l in[s[r]]+[f'/{" "*i}\\'for i in range(1,r,2)]]+[*map(' '.join,zip(t(s[:r]),t(s[r+1:])))]or[s]

Try it online!Try it online!

Python 3.8 (pre-release),  158   144  143 bytes

-14 bytes by Unrelated String.
-1 byte by emanresu A.

t=lambda s:(r:=len(s)//2)and[l.center(r*2+1)for l in[s[r]]+[f'/{" "*i}\\'for i in range(1,r,2)]]+[*map(' '.join,zip(t(s[:r]),t(s[r+1:])))]or[s]

Try it online!

Python 3.8 (pre-release),  158   144   143  142 bytes

-14 bytes by Unrelated String.
-2 bytes by emanresu A.

t=lambda s:(r:=len(s)//2)and[l.center(r-~r)for l in[s[r]]+[f'/{" "*i}\\'for i in range(1,r,2)]]+[*map(' '.join,zip(t(s[:r]),t(s[r+1:])))]or[s]

Try it online!

-15 bytes by Unrelated String and emanresu A.
Source Link
squareroot12621
  • 1.2k
  • 1
  • 3
  • 18

Python 3.8 (pre-release), 158 158   144  143 bytes

-14 bytes by Unrelated String.
-1 byte by emanresu A.

t=lambda s:(r:=len(s)//2)and[l.center(r*2+1)for l in[s[r]]+['in[s[r]]+[f'/'+'{" '*i+'\\'for"*i}\\'for i in range(1,r,2)]]+[i+' '+j for]]+[*map(' i'.join,j in zip(t(s[:r]),t(s[r+1:]))]if s[1:]else[s])]or[s]

Try it online!Try it online!

Python 3.8 (pre-release), 158 bytes

t=lambda s:(r:=len(s)//2)and[l.center(r*2+1)for l in[s[r]]+['/'+' '*i+'\\'for i in range(1,r,2)]]+[i+' '+j for i,j in zip(t(s[:r]),t(s[r+1:]))]if s[1:]else[s]

Try it online!

Python 3.8 (pre-release),  158   144  143 bytes

-14 bytes by Unrelated String.
-1 byte by emanresu A.

t=lambda s:(r:=len(s)//2)and[l.center(r*2+1)for l in[s[r]]+[f'/{" "*i}\\'for i in range(1,r,2)]]+[*map(' '.join,zip(t(s[:r]),t(s[r+1:])))]or[s]

Try it online!

Source Link
squareroot12621
  • 1.2k
  • 1
  • 3
  • 18

Python 3.8 (pre-release), 158 bytes

t=lambda s:(r:=len(s)//2)and[l.center(r*2+1)for l in[s[r]]+['/'+' '*i+'\\'for i in range(1,r,2)]]+[i+' '+j for i,j in zip(t(s[:r]),t(s[r+1:]))]if s[1:]else[s]

Try it online!