so we had this super basic kind of intro to python assignment in one of my CS classes. Really easy and it has full functionality rn, but I wanna make it smaller. what changes could compact the code size?
link to code here in case you don't want to hand type the picture:
https://repl.it/GLwe/0
>>277334
You could set a variable to random like r=random, then replace the calls random.choice, random.randint to r.choice, r.randint
Also you could replace the print(a)print(b)print(c)
with print(a+"\n"+b+"\n"+c)
>>277342
Oh and the same with string, so l = string.ascii_lowercase, and then replace the occurrences
>>277344
I think I can one up that by doing:
from string import ascii_lowercase as lc
which saves a variable declaration. looks like I cant do the numbers in a single line print sad times.
Current code:
https://repl.it/GLwe/3
>>277348
Oh yeah forgot about that. Here are some more adjustments (more function renames), we don't need whitespace do we?
https://repl.it/GLwe/5
>>277355
>>277348
>>277344
>>277342
For fuck's sake, stop minifying the source code. Python is a compiled language. The compiler does all this shit for you, and all you're doing is duplicating its work.
You can get twice the gains from making your code unreadable by writing a function then calling it on your three files.