Almost Static
@almostStatic
Passionate computer science student and good friends with @RossJames
Public Repls
Community
0
omgthisprogrammeisactuallysolongOur legendary computer science teacher gave us a task to shorten code. Originally, somebody got it from 71 or so lines down to 20, then somebody else to 15, and so on till somebody got 4 lines. I went home and spent about 30 minutes on it and got it in 2 lines. Boom. Also got one with only one line but I don't know if I want to count that since it was in another file.
I doubt anyone will get anything lower than 2 lines - primarily because of the for .. in function requiring a newline; you must use a for .. in loop in order to loop through every element, as Python does not come with any built-in functions that allow this.
In JavaScript, I can easily rewrite this in one line due to it being a better language (and that you can use semicolons to manage and terminate statements that therefore allow you to write your entire programme on one line, albeit not advised)
0
0