[Solved] What do you think about this code? Any better Solution? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

[Solved] What do you think about this code? Any better Solution?

This question is from a competitive coding site and a practice question of python in it. https://code.sololearn.com/c41338A16A9a/#py

17th Jul 2021, 4:06 PM
Shubham Aggarwal
Shubham Aggarwal - avatar
8 Answers
+ 5
yeeees... at least another one. if you replace abcde... by 01234.... the numbers will show the distance from center of your figure going vertically or horizontally. This interpretation of your figure leads to a shorter code https://code.sololearn.com/cARCI7mSvK31/?ref=app
17th Jul 2021, 6:54 PM
Oma Falk
Oma Falk - avatar
+ 5
Your code works fine. But a bit lengthy but still very good because it does the job. Here's a version of mine: https://code.sololearn.com/c2a19a0a25a1/?ref=app
17th Jul 2021, 7:16 PM
Rohit
+ 2
Oma Falk It have "-" in between the characters so it will not work.
17th Jul 2021, 7:14 PM
Shubham Aggarwal
Shubham Aggarwal - avatar
+ 2
My version :) I use a lot of slicing, and mirroring https://code.sololearn.com/c1QU0zzpm53e/?ref=app
18th Jul 2021, 1:47 PM
Tibor Santa
Tibor Santa - avatar
+ 1
Shubham Aggarwal a little adaptation did it
17th Jul 2021, 7:50 PM
Oma Falk
Oma Falk - avatar
+ 1
17th Jul 2021, 7:52 PM
Shubham Aggarwal
Shubham Aggarwal - avatar
+ 1
Noted.
17th Jul 2021, 8:12 PM
Calvin Thomas
Calvin Thomas - avatar
+ 1
Here's my one-liner solution (inefficient though): https://code.sololearn.com/cqzjH5MvL1yc/?ref=app # Hope this helps
19th Jul 2021, 7:38 AM
Calvin Thomas
Calvin Thomas - avatar