How do I edit this code to make it more simple? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How do I edit this code to make it more simple?

https://code.sololearn.com/cfBzpK0Lv30i/# I think I should separate this code by new class or attribute, but what should I do first?

13th Feb 2019, 9:09 AM
Shumpei Sori
Shumpei Sori - avatar
3 Answers
+ 1
Other SoloLearners more knowledgeable with the numbers may be able to tell you more important improvements, but I want to recommend two minor things: 1.) You can break up very long lines by splitting strings: print('This is a very, very, very...' 'well, longish sentence.') The two strings are read as one, and any set of brackets leads to 'implicit line continuation' which gives you some formatting leeway. (More details down there.) https://code.sololearn.com/c9a0cG9dpVUr/?ref=app The usual recommendation is to keep lines around width 80 max, but if we assume that many SoloLearners read your code on a smartphone, something like 60 max or even less may work better. 2.) In Python, instead of writing print('-----------... you can do: print(50 * '-')
13th Feb 2019, 10:07 AM
HonFu
HonFu - avatar
+ 1
Definitions (and use) of functions will help you to subdivide your code into something of more manageable pieces .. Actually is hard follow your code
13th Feb 2019, 11:19 AM
KrOW
KrOW - avatar
0
You can do some easy practices in codewars. Then you will begin to make your code simpler.
14th Feb 2019, 8:46 AM
okan
okan - avatar