Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Post History

60%
+1 −0
Challenges Word Set Square

Python 3, 196 195 145 102 91 89 87 79 bytes x=input();x+=x[::-1];i=-1 for c in x[:-1]:print(c*(i>-1)+" "*i+c);i+=1 print(x) Try it online! Golfed 50 bytes thanks to @celtschk's advice. ...

posted 3y ago by General Sebast1an‭  ·  edited 3y ago by General Sebast1an‭

Answer
#14: Post edited by user avatar General Sebast1an‭ · 2021-09-05T05:59:03Z (over 3 years ago)
  • # [Python 3], <s>196</s> <s>195</s> <s>145</s> <s>102</s> <s>91</s> <s>89</s> 87 bytes
  • <!-- language-all: lang-python -->
  • x=input();x+=x[-2::-1]
  • for i,c in enumerate(x[:-1]):print(c*(i>0)+" "*(i-1)+c)
  • print(x)
  • [Try it online!][TIO-kt6oqytc]
  • Golfed 50 bytes thanks to [**@celtschk**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4381#comment-13354). Golfed another 43 bytes thanks to [**@celtschk**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4382#comment-13355). Golfed another 11 bytes thanks to [**@celtschk**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4382#comment-13356). Golfed another 2 bytes thanks to [**@celtschk**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4382#comment-13366). Golfed 2 bytes thanks to [**@Moshi**](https://codegolf.codidact.com/users/53196)'s [advice](https://codegolf.codidact.com/comments/thread/4385#comment-13374).
  • [Python 3]: https://docs.python.org/3/
  • [TIO-kt6oqytc]: https://tio.run/##JclLCoAgEADQfaeQVk4m9NkZdZFoEWI0UKOIwXR6K9o9eOFOu6c@Zx6RwpUkDKxGnnVnjG6XYvNRYG0FknB0nS6uyUmevwMTIlKStpI4NaBKUb7SLSgLxV8MOe/uOPwD "Python 3 – Try It Online"
  • # [Python 3], <s>196</s> <s>195</s> <s>145</s> <s>102</s> <s>91</s> <s>89</s> <s>87</s> 79 bytes
  • <!-- language-all: lang-python -->
  • x=input();x+=x[::-1];i=-1
  • for c in x[:-1]:print(c*(i>-1)+" "*i+c);i+=1
  • print(x)
  • [Try it online!][TIO-kt6szafi]
  • Golfed 50 bytes thanks to [**@celtschk**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4381#comment-13354). Golfed another 43 bytes thanks to [**@celtschk**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4382#comment-13355). Golfed another 11 bytes thanks to [**@celtschk**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4382#comment-13356). Golfed another 2 bytes thanks to [**@celtschk**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4382#comment-13366). Golfed 2 bytes thanks to [**@Moshi**](https://codegolf.codidact.com/users/53196)'s [advice](https://codegolf.codidact.com/comments/thread/4385#comment-13374). Golfed another 8 bytes thanks to [**@Moshi**](https://codegolf.codidact.com/users/53196)'s [advice](https://codegolf.codidact.com/comments/thread/4388#comment-13380).
  • [Python 3]: https://docs.python.org/3/
  • [TIO-kt6szafi]: https://tio.run/##JcmxCoAgEADQ3a8QJ/VwkDbFfiSapPBAThED@3oTWt@rb0@FtjlHQKpPl8oPCONwztjTYzCW3aXxyJH40oWuNqQuo5a4G6tAcKERovIIwbI/h5ozXTmXDw "Python 3 – Try It Online"
#13: Post edited by user avatar General Sebast1an‭ · 2021-09-05T04:00:11Z (over 3 years ago)
  • # [Python 3], <s>196</s> <s>195</s> <s>145</s> <s>102</s> <s>91</s> 89 bytes
  • <!-- language-all: lang-python -->
  • x=input();x+=x[-2::-1]
  • for i,c in enumerate(x[:-1]):print(c*bool(i)+" "*(i-1)+c)
  • print(x)
  • [Try it online!][TIO-kt6oo0tr]
  • Golfed 50 bytes thanks to [**@celtschk**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4381#comment-13354). Golfed another 43 bytes thanks to [**@celtschk**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4382#comment-13355). Golfed another 11 bytes thanks to [**@celtschk**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4382#comment-13356). Golfed another 2 bytes thanks to [**@celtschk**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4382#comment-13366).
  • [Python 3]: https://docs.python.org/3/
  • [TIO-kt6oo0tr]: https://tio.run/##JcnBCoMwDADQu19RPCXWHpy3Dr9EPLjSYaBLSqkQv75DfNeXr3oIz63pQpzPCvhWu@jqXt67aeu@UgyNwRCbyOcvlr1G0PU@9LkQVwjDRyQBoe1NPwC5CW3A7knF1o6YkvwB "Python 3 – Try It Online"
  • # [Python 3], <s>196</s> <s>195</s> <s>145</s> <s>102</s> <s>91</s> <s>89</s> 87 bytes
  • <!-- language-all: lang-python -->
  • x=input();x+=x[-2::-1]
  • for i,c in enumerate(x[:-1]):print(c*(i>0)+" "*(i-1)+c)
  • print(x)
  • [Try it online!][TIO-kt6oqytc]
  • Golfed 50 bytes thanks to [**@celtschk**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4381#comment-13354). Golfed another 43 bytes thanks to [**@celtschk**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4382#comment-13355). Golfed another 11 bytes thanks to [**@celtschk**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4382#comment-13356). Golfed another 2 bytes thanks to [**@celtschk**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4382#comment-13366). Golfed 2 bytes thanks to [**@Moshi**](https://codegolf.codidact.com/users/53196)'s [advice](https://codegolf.codidact.com/comments/thread/4385#comment-13374).
  • [Python 3]: https://docs.python.org/3/
  • [TIO-kt6oqytc]: https://tio.run/##JclLCoAgEADQfaeQVk4m9NkZdZFoEWI0UKOIwXR6K9o9eOFOu6c@Zx6RwpUkDKxGnnVnjG6XYvNRYG0FknB0nS6uyUmevwMTIlKStpI4NaBKUb7SLSgLxV8MOe/uOPwD "Python 3 – Try It Online"
#12: Post edited by user avatar General Sebast1an‭ · 2021-09-05T03:58:24Z (over 3 years ago)
  • # [Python 3], <s>196</s> <s>195</s> <s>145</s> <s>102</s> 91 bytes
  • <!-- language-all: lang-python -->
  • x=input();x+=x[-2::-1]
  • for i in range(len(x)-1):print(x[i]*bool(i)+" "*(i-1)+x[i])
  • print(x)
  • [Try it online!][TIO-kt5sepjw]
  • Golfed 50 bytes thanks to [**@celtschk**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4381#comment-13354). Golfed another 43 bytes thanks to [**@celtschk**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4382#comment-13355). Golfed another 11 bytes thanks to [**@celtschk**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4382#comment-13356).
  • [Python 3]: https://docs.python.org/3/
  • [TIO-kt5sepjw]: https://tio.run/##LcpBCsMgEEDRvaeQrGYiLtLuLJ4kuEjBNgMyI2JhcnqbQLb//Xr0Xfg5hkbi@uuAL3VRV/8IwS/JfKRZssS2bfzNUDKDol8w1EbcQVdK81ukAKGb7DQDneiujOZecIw9lyJ/ "Python 3 – Try It Online"
  • # [Python 3], <s>196</s> <s>195</s> <s>145</s> <s>102</s> <s>91</s> 89 bytes
  • <!-- language-all: lang-python -->
  • x=input();x+=x[-2::-1]
  • for i,c in enumerate(x[:-1]):print(c*bool(i)+" "*(i-1)+c)
  • print(x)
  • [Try it online!][TIO-kt6oo0tr]
  • Golfed 50 bytes thanks to [**@celtschk**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4381#comment-13354). Golfed another 43 bytes thanks to [**@celtschk**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4382#comment-13355). Golfed another 11 bytes thanks to [**@celtschk**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4382#comment-13356). Golfed another 2 bytes thanks to [**@celtschk**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4382#comment-13366).
  • [Python 3]: https://docs.python.org/3/
  • [TIO-kt6oo0tr]: https://tio.run/##JcnBCoMwDADQu19RPCXWHpy3Dr9EPLjSYaBLSqkQv75DfNeXr3oIz63pQpzPCvhWu@jqXt67aeu@UgyNwRCbyOcvlr1G0PU@9LkQVwjDRyQBoe1NPwC5CW3A7knF1o6YkvwB "Python 3 – Try It Online"
#11: Post edited by user avatar General Sebast1an‭ · 2021-09-04T12:57:38Z (over 3 years ago)
  • # [Python 3], <s>196</s> <s>195</s> <s>145</s> <s>102</s> 92 bytes
  • <!-- language-all: lang-python -->
  • x=input();
  • x+=x[-2::-1]
  • for i in range(len(x)-1):print(x[i]*bool(i)+" "*(i-1)+x[i])
  • print(x)
  • [Try it online!][TIO-kt5sepjw]
  • Golfed 50 bytes thanks to [**@celtschk**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4381#comment-13354). Golfed another 42 bytes thanks to [**@celtschk**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4382#comment-13355). Golfed another 10 bytes thanks to [**@celtschk**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4382#comment-13356).
  • [Python 3]: https://docs.python.org/3/
  • [TIO-kt5sepjw]: https://tio.run/##LcpBCsMgEEDRvaeQrGYUF2l3Fk8SsmjANgMyI2JhcnrTQLb//Xr0Xfg5hibi@uuAL6M@6RIeMYZ5NR9pliyxbW/@ZiiZQTHMGGsj7qALrW4TKUDoJzs5oD/6K6O5Fxxjz6XICQ "Python 3 – Try It Online"
  • # [Python 3], <s>196</s> <s>195</s> <s>145</s> <s>102</s> 91 bytes
  • <!-- language-all: lang-python -->
  • x=input();x+=x[-2::-1]
  • for i in range(len(x)-1):print(x[i]*bool(i)+" "*(i-1)+x[i])
  • print(x)
  • [Try it online!][TIO-kt5sepjw]
  • Golfed 50 bytes thanks to [**@celtschk**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4381#comment-13354). Golfed another 43 bytes thanks to [**@celtschk**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4382#comment-13355). Golfed another 11 bytes thanks to [**@celtschk**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4382#comment-13356).
  • [Python 3]: https://docs.python.org/3/
  • [TIO-kt5sepjw]: https://tio.run/##LcpBCsMgEEDRvaeQrGYiLtLuLJ4kuEjBNgMyI2JhcnqbQLb//Xr0Xfg5hkbi@uuAL3VRV/8IwS/JfKRZssS2bfzNUDKDol8w1EbcQVdK81ukAKGb7DQDneiujOZecIw9lyJ/ "Python 3 – Try It Online"
#10: Post edited by user avatar General Sebast1an‭ · 2021-09-04T12:55:42Z (over 3 years ago)
  • # [Python 3], <s>196</s> <s>195</s> <s>145</s> 102 bytes
  • <!-- language-all: lang-python -->
  • <pre><code>x=input();x+=x[-2::-1]
  • for i in range(len(x)-1):
  • &#9;if i:print(x[i],end=" "*(i-1))
  • &#9;print(x[i])
  • print(x)
  • </code></pre>
  • [Try it online!][TIO-kt5qef9i]
  • Golfed 50 bytes thanks to [**@celtschk**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4381#comment-13354). Golfed another 42 bytes thanks to [**@celtschk**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4382#comment-13355).
  • [Python 3]: https://docs.python.org/3/
  • [TIO-kt5qef9i]: https://tio.run/##RcmxCoMwEADQ2XzF4XRXzaDdUvIl4iA06kG4hBDh/Pq0Q6Hbg5fveiZ5tqaeJV8V6aWD18XOztlpNXsqwMACZZMjYAyCSnYiZzregV0uLBV14XUM8vY99A/k75Pp/kXmZ2rtDDGmDw "Python 3 – Try It Online"
  • # [Python 3], <s>196</s> <s>195</s> <s>145</s> <s>102</s> 92 bytes
  • <!-- language-all: lang-python -->
  • x=input();
  • x+=x[-2::-1]
  • for i in range(len(x)-1):print(x[i]*bool(i)+" "*(i-1)+x[i])
  • print(x)
  • [Try it online!][TIO-kt5sepjw]
  • Golfed 50 bytes thanks to [**@celtschk**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4381#comment-13354). Golfed another 42 bytes thanks to [**@celtschk**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4382#comment-13355). Golfed another 10 bytes thanks to [**@celtschk**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4382#comment-13356).
  • [Python 3]: https://docs.python.org/3/
  • [TIO-kt5sepjw]: https://tio.run/##LcpBCsMgEEDRvaeQrGYUF2l3Fk8SsmjANgMyI2JhcnrTQLb//Xr0Xfg5hibi@uuAL6M@6RIeMYZ5NR9pliyxbW/@ZiiZQTHMGGsj7qALrW4TKUDoJzs5oD/6K6O5Fxxjz6XICQ "Python 3 – Try It Online"
#9: Post edited by user avatar celtschk‭ · 2021-09-04T12:53:01Z (over 3 years ago)
Fixed spelling of my user name
  • # [Python 3], <s>196</s> <s>195</s> <s>145</s> 102 bytes
  • <!-- language-all: lang-python -->
  • <pre><code>x=input();x+=x[-2::-1]
  • for i in range(len(x)-1):
  • &#9;if i:print(x[i],end=" "*(i-1))
  • &#9;print(x[i])
  • print(x)
  • </code></pre>
  • [Try it online!][TIO-kt5qef9i]
  • Golfed 50 bytes thanks to [**@celtshck**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4381#comment-13354). Golfed another 42 bytes thanks to [**@celtshck**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4382#comment-13355).
  • [Python 3]: https://docs.python.org/3/
  • [TIO-kt5qef9i]: https://tio.run/##RcmxCoMwEADQ2XzF4XRXzaDdUvIl4iA06kG4hBDh/Pq0Q6Hbg5fveiZ5tqaeJV8V6aWD18XOztlpNXsqwMACZZMjYAyCSnYiZzregV0uLBV14XUM8vY99A/k75Pp/kXmZ2rtDDGmDw "Python 3 – Try It Online"
  • # [Python 3], <s>196</s> <s>195</s> <s>145</s> 102 bytes
  • <!-- language-all: lang-python -->
  • <pre><code>x=input();x+=x[-2::-1]
  • for i in range(len(x)-1):
  • &#9;if i:print(x[i],end=" "*(i-1))
  • &#9;print(x[i])
  • print(x)
  • </code></pre>
  • [Try it online!][TIO-kt5qef9i]
  • Golfed 50 bytes thanks to [**@celtschk**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4381#comment-13354). Golfed another 42 bytes thanks to [**@celtschk**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4382#comment-13355).
  • [Python 3]: https://docs.python.org/3/
  • [TIO-kt5qef9i]: https://tio.run/##RcmxCoMwEADQ2XzF4XRXzaDdUvIl4iA06kG4hBDh/Pq0Q6Hbg5fveiZ5tqaeJV8V6aWD18XOztlpNXsqwMACZZMjYAyCSnYiZzregV0uLBV14XUM8vY99A/k75Pp/kXmZ2rtDDGmDw "Python 3 – Try It Online"
#8: Post edited by user avatar General Sebast1an‭ · 2021-09-04T11:57:51Z (over 3 years ago)
  • # [Python 3], <s>196</s> <s>195</s> <s>145</s> 103 bytes
  • <!-- language-all: lang-python -->
  • <pre><code>x=input();
  • x+=x[-2::-1]
  • for i in range(len(x)-1):
  • &#9;if i:print(x[i],end=" "*(i-1))
  • &#9;print(x[i])
  • print(x)
  • </code></pre>
  • [Try it online!][TIO-kt5qa1cq]
  • Golfed 50 bytes thanks to [**@celtshck**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4381#comment-13354). Golfed another 42 bytes thanks to [**@celtshck**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4382#comment-13355).
  • [Python 3]: https://docs.python.org/3/
  • [TIO-kt5qa1cq]: https://tio.run/##RckxCsMwDADAOXqFyCS18ZB2c/FLQoZAnUZgZGMcUF/vdih0O7jybkfWe@8WRMvZiB9g12CLu3nv5hX2XFFQFOumr0gpKhm7mT0MsqP4UkUb2SLrFPUZRhwvJN9nGP7F8DP3fsSU8gc "Python 3 – Try It Online"
  • # [Python 3], <s>196</s> <s>195</s> <s>145</s> 102 bytes
  • <!-- language-all: lang-python -->
  • <pre><code>x=input();x+=x[-2::-1]
  • for i in range(len(x)-1):
  • &#9;if i:print(x[i],end=" "*(i-1))
  • &#9;print(x[i])
  • print(x)
  • </code></pre>
  • [Try it online!][TIO-kt5qef9i]
  • Golfed 50 bytes thanks to [**@celtshck**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4381#comment-13354). Golfed another 42 bytes thanks to [**@celtshck**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4382#comment-13355).
  • [Python 3]: https://docs.python.org/3/
  • [TIO-kt5qef9i]: https://tio.run/##RcmxCoMwEADQ2XzF4XRXzaDdUvIl4iA06kG4hBDh/Pq0Q6Hbg5fveiZ5tqaeJV8V6aWD18XOztlpNXsqwMACZZMjYAyCSnYiZzregV0uLBV14XUM8vY99A/k75Pp/kXmZ2rtDDGmDw "Python 3 – Try It Online"
#7: Post edited by user avatar General Sebast1an‭ · 2021-09-04T11:55:28Z (over 3 years ago)
  • # [Python 3], <s>196</s> <s>195</s> 145 bytes
  • <!-- language-all: lang-python -->
  • <pre><code>x=input();j=len(x)
  • for i in range(j):
  • &#9;try:x+=x[j-i]
  • &#9;except:j-=1
  • for i in range(len(x)-1):
  • &#9;if i:print(x[i],end=" "*(i-1))
  • &#9;print(x[i])
  • print(x)
  • </code></pre>
  • [Try it online!][TIO-kt5o66ep]
  • Golfed 50 bytes thanks to [**@celtshck**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4381#comment-13354).
  • [Python 3]: https://docs.python.org/3/
  • [TIO-kt5o66ep]: https://tio.run/##XYxBCsIwEEXXySlCVxk1i@IukpOULkSndkKYhJDC9PRRURDcPXjv/7K3NfO5dwnEZWsWLjEkZCugl1wNGWJTr/xAG8Fr1eru5Rhkio5mrVBuWJqPLoz/@efEje8VLYZ8qcTNykTzCfkeBjMcLL08aPVToL8Mva@YUn4C "Python 3 – Try It Online"
  • # [Python 3], <s>196</s> <s>195</s> <s>145</s> 103 bytes
  • <!-- language-all: lang-python -->
  • <pre><code>x=input();
  • x+=x[-2::-1]
  • for i in range(len(x)-1):
  • &#9;if i:print(x[i],end=" "*(i-1))
  • &#9;print(x[i])
  • print(x)
  • </code></pre>
  • [Try it online!][TIO-kt5qa1cq]
  • Golfed 50 bytes thanks to [**@celtshck**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4381#comment-13354). Golfed another 42 bytes thanks to [**@celtshck**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4382#comment-13355).
  • [Python 3]: https://docs.python.org/3/
  • [TIO-kt5qa1cq]: https://tio.run/##RckxCsMwDADAOXqFyCS18ZB2c/FLQoZAnUZgZGMcUF/vdih0O7jybkfWe@8WRMvZiB9g12CLu3nv5hX2XFFQFOumr0gpKhm7mT0MsqP4UkUb2SLrFPUZRhwvJN9nGP7F8DP3fsSU8gc "Python 3 – Try It Online"
#6: Post edited by user avatar General Sebast1an‭ · 2021-09-04T10:56:05Z (over 3 years ago)
  • # [Python 3], <s>196</s> 195 bytes
  • <!-- language-all: lang-python -->
  • <pre><code>s=input();x=s;j=len(s)
  • for i in range(j):
  • &#9;try:x+=s[j-i]
  • &#9;except:j-=1
  • k=-1
  • for i in range(len(x)-1):
  • &#9;if i^0:
  • &#9;&#9;print(x[i],end='')
  • &#9;&#9;for j in range(k):print(" ",end='')
  • &#9;k+=1;print(x[i])
  • print(x)
  • </code></pre>
  • [Try it online!][TIO-kt5npi6m]
  • [Python 3]: https://docs.python.org/3/
  • [TIO-kt5npi6m]: https://tio.run/##XcxBCoMwFATQtTlFcGM@NtDQXeSfRCyUNrY/SgxJCvH0qdKC0N0wzBu/ptfiLqVEJOffSUCXMXYWZ@NEBDYugRMnx8PNPY2woFmVwqpzi7G3kgZWmXw3PmkrUbEJpfo3@1MGqXZKI6freQuVD@SSyD0NJ@Me2DSwlbu0h5xAf2c1r4/V1KLqDg7sl6GUl5nn5QM "Python 3 – Try It Online"
  • # [Python 3], <s>196</s> <s>195</s> 145 bytes
  • <!-- language-all: lang-python -->
  • <pre><code>x=input();j=len(x)
  • for i in range(j):
  • &#9;try:x+=x[j-i]
  • &#9;except:j-=1
  • for i in range(len(x)-1):
  • &#9;if i:print(x[i],end=" "*(i-1))
  • &#9;print(x[i])
  • print(x)
  • </code></pre>
  • [Try it online!][TIO-kt5o66ep]
  • Golfed 50 bytes thanks to [**@celtshck**](https://codegolf.codidact.com/users/8056)'s [advice](https://codegolf.codidact.com/comments/thread/4381#comment-13354).
  • [Python 3]: https://docs.python.org/3/
  • [TIO-kt5o66ep]: https://tio.run/##XYxBCsIwEEXXySlCVxk1i@IukpOULkSndkKYhJDC9PRRURDcPXjv/7K3NfO5dwnEZWsWLjEkZCugl1wNGWJTr/xAG8Fr1eru5Rhkio5mrVBuWJqPLoz/@efEje8VLYZ8qcTNykTzCfkeBjMcLL08aPVToL8Mva@YUn4C "Python 3 – Try It Online"
#5: Post edited by user avatar General Sebast1an‭ · 2021-09-04T10:51:02Z (over 3 years ago)
  • # [Python 3], 196 bytes
  • <!-- language-all: lang-python -->
  • <pre><code>s=input();x=s;j=len(s)
  • for i in range(j):
  • &#9;try:x+=s[j-i]
  • &#9;except:j-=1
  • k=1
  • for i in range(len(x)-1):
  • &#9;if i^0:
  • &#9;&#9;print(x[i],end='')
  • &#9;&#9;for j in range(k-2):print(" ",end='')
  • &#9;k+=1;print(x[i])
  • print(x)
  • </code></pre>
  • [Try it online!][TIO-kt5kc5ze]
  • [Python 3]: https://docs.python.org/3/
  • [TIO-kt5kc5ze]: https://tio.run/##XYxBCoMwFETX5hTBjfnYQG13kZxELJQ21h/lG5IU4ulTpQWhi4FheG/cGseFrjkHjeTeUUCbdGitng2JAGxYPEeOxP2dXkZYUKyIflWp1qGzEntWmPQwLiordcOmLX/KfpRANruJA8fbeSuF80hRpA77k6GnrirYxt20hznJC6gvWPLy4KZaN@1xAOzXIefRzPPyAQ "Python 3 – Try It Online"
  • # [Python 3], <s>196</s> 195 bytes
  • <!-- language-all: lang-python -->
  • <pre><code>s=input();x=s;j=len(s)
  • for i in range(j):
  • &#9;try:x+=s[j-i]
  • &#9;except:j-=1
  • k=-1
  • for i in range(len(x)-1):
  • &#9;if i^0:
  • &#9;&#9;print(x[i],end='')
  • &#9;&#9;for j in range(k):print(" ",end='')
  • &#9;k+=1;print(x[i])
  • print(x)
  • </code></pre>
  • [Try it online!][TIO-kt5npi6m]
  • [Python 3]: https://docs.python.org/3/
  • [TIO-kt5npi6m]: https://tio.run/##XcxBCoMwFATQtTlFcGM@NtDQXeSfRCyUNrY/SgxJCvH0qdKC0N0wzBu/ptfiLqVEJOffSUCXMXYWZ@NEBDYugRMnx8PNPY2woFmVwqpzi7G3kgZWmXw3PmkrUbEJpfo3@1MGqXZKI6freQuVD@SSyD0NJ@Me2DSwlbu0h5xAf2c1r4/V1KLqDg7sl6GUl5nn5QM "Python 3 – Try It Online"
#4: Post undeleted by user avatar General Sebast1an‭ · 2021-09-04T09:08:10Z (over 3 years ago)
#3: Post edited by user avatar General Sebast1an‭ · 2021-09-04T09:07:57Z (over 3 years ago)
  • # [Python 3], 195 bytes
  • <!-- language-all: lang-python -->
  • <pre><code>s=input();x=s;j=len(s)
  • for i in range(j):
  • &#9;try:x+=s[j-i]
  • &#9;except:j-=1
  • k=1
  • for i in range(len(x)-1):
  • &#9;if i^0:print(x[0],end='')
  • &#9;for j in range(k-2):
  • &#9;&#9;print(" ",end='')
  • &#9;k+=1;print(x[i])
  • print(x)
  • </code></pre>
  • [Try it online!][TIO-kt5k6ade]
  • A tricky challenge but managed it. Had to do some math there. lmao
  • [Python 3]: https://docs.python.org/3/
  • [TIO-kt5k6ade]: https://tio.run/##XczRCsIgGAXga30K2c38WcJWdw6fZCyIcvW74UQN3NNbUjHo4sC5ON9xW3ys9pRzUGjdM3Lokwq9UYu2PACdVs@QoWX@Yu@aG5CURL/J1KgwGIEjJTpdtYvSCNXR@Z0/Uo4SiK5InBieW@k82sjT0I4HbW@qroGSosyuZnEsgHymFav25dyorv9d4Aj02yHnh16W9QU "Python 3 – Try It Online"
  • # [Python 3], 196 bytes
  • <!-- language-all: lang-python -->
  • <pre><code>s=input();x=s;j=len(s)
  • for i in range(j):
  • &#9;try:x+=s[j-i]
  • &#9;except:j-=1
  • k=1
  • for i in range(len(x)-1):
  • &#9;if i^0:
  • &#9;&#9;print(x[i],end='')
  • &#9;&#9;for j in range(k-2):print(" ",end='')
  • &#9;k+=1;print(x[i])
  • print(x)
  • </code></pre>
  • [Try it online!][TIO-kt5kc5ze]
  • [Python 3]: https://docs.python.org/3/
  • [TIO-kt5kc5ze]: https://tio.run/##XYxBCoMwFETX5hTBjfnYQG13kZxELJQ21h/lG5IU4ulTpQWhi4FheG/cGseFrjkHjeTeUUCbdGitng2JAGxYPEeOxP2dXkZYUKyIflWp1qGzEntWmPQwLiordcOmLX/KfpRANruJA8fbeSuF80hRpA77k6GnrirYxt20hznJC6gvWPLy4KZaN@1xAOzXIefRzPPyAQ "Python 3 – Try It Online"
#2: Post deleted by user avatar General Sebast1an‭ · 2021-09-04T09:04:04Z (over 3 years ago)
#1: Initial revision by user avatar General Sebast1an‭ · 2021-09-04T09:03:48Z (over 3 years ago)
# [Python 3], 195 bytes

<!-- language-all: lang-python -->

<pre><code>s=input();x=s;j=len(s)
for i in range(j):
&#9;try:x+=s[j-i]
&#9;except:j-=1
k=1
for i in range(len(x)-1):
&#9;if i^0:print(x[0],end='')
&#9;for j in range(k-2):
&#9;&#9;print(" ",end='')
&#9;k+=1;print(x[i])
print(x)
</code></pre>

[Try it online!][TIO-kt5k6ade]

A tricky challenge but managed it. Had to do some math there. lmao

[Python 3]: https://docs.python.org/3/
[TIO-kt5k6ade]: https://tio.run/##XczRCsIgGAXga30K2c38WcJWdw6fZCyIcvW74UQN3NNbUjHo4sC5ON9xW3ys9pRzUGjdM3Lokwq9UYu2PACdVs@QoWX@Yu@aG5CURL/J1KgwGIEjJTpdtYvSCNXR@Z0/Uo4SiK5InBieW@k82sjT0I4HbW@qroGSosyuZnEsgHymFav25dyorv9d4Aj02yHnh16W9QU "Python 3 – Try It Online"