+ 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?
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 * '-')
+ 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
0
You can do some easy practices in codewars. Then you will begin to make your code simpler.