+ 3
Should I improve readability?
It works, but is the code readable enough for a human? If it's not, how can I improve it? https://code.sololearn.com/cdvRA0FTN7Bh/?ref=app
5 ответов
+ 6
That's a well written and well organized code.
It's totally readable.
And actually the forceful indentation makes python code most easy to read.
+ 6
No need to put the whole alphabet in a list, you can just do alphabet = list('ABCDE...') or import ascii_uppercase from the string module
for xxx:
if condition:
yyy
else:
continue
The "else continue" part doesn't do anything. If the condition isn't met, it will continue anyway
Try to be consistent with your indentation. You alternate between 3 and 4 spaces
+ 5
Before function you can use pydoc strings to explain parameters and what is returned.
+ 1
You can rename variables and the function according to PEP8 style guide:
"Function and Variable Names
Function names should be lowercase, with words separated by underscores as necessary to improve readability.
Variable names follow the same convention as function names.
mixedCase is allowed only in contexts where that's already the prevailing style (e.g. threading.py), to retain backwards compatibility."
https://www.python.org/dev/peps/pep-0008/
+ 1
A thing I learnt along the time was the importance reability. Coding is hard and computers are really fast. To use them properly, a safer code is better than a faster code. If the code you are write is really intersting and usefulll, along the time you will improve some aspect of it. So, reability, even not being essential mathematically or philosophically , in praxis, reability is fundamental for coding, in special, for really useful codes that you could use along the years, a well attacked problem