+ 1

What is the best way of writing code?

I often write stupid codes like from secrets import token_hex as t from random import randint as r print(''.join(list(map(lambda x : x.upper() if r(0,2) else x , list(t(24))))))#generates 24 digit key with uppercase and lowercase letters with numbers Because I don't want codes to be redundant and make my code of 1000 lines. I often lose track of everything. How can i write them in a understandable way without silly comments or variables?

25th Jul 2020, 2:18 PM
Wasi
Wasi - avatar
6 odpowiedzi
+ 5
Long codes are not difficult to maintain, if they are good...
25th Jul 2020, 2:43 PM
Sandra Meyer
Sandra Meyer - avatar
+ 4
Use proper, meaningful names and correct formatting.
25th Jul 2020, 2:24 PM
Sandra Meyer
Sandra Meyer - avatar
25th Jul 2020, 2:26 PM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 1
~ swim ~ I am expecting that you will help me to write code which is neither long nor short. You can tell me what to avoid , how to write, some useful resources, etc. Long codes are hard to maintain and short ones are hard to understand.
25th Jul 2020, 2:41 PM
Wasi
Wasi - avatar