Skip to content
    almostStatic

    Almost Static

    @almostStatic
    Passionate computer science student and good friends with @RossJames
    almostStatic
    almostStatic
    published a Repl
    3 years ago
    0
    omgthisprogrammeisactuallysolong
    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)
    Copyright © 2024 Replit, Inc. All rights reserved.
    • twitter
    • tiktok
    • instagram
    • facebook

    Replit

    Programming languages

    • Python
    • JavaScript
    • TypeScript
    • Node.js
    • Nix
    • HTML, CSS, JS
    • C++
    • Golang