86thumbs
  • Communities
  • Create Post
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
Destide@feddit.uk to Programmer Humor@lemmy.mlEnglish · 1 day ago

Infallible Code

lemmy.ml

message-square
151
fedilink
424

Infallible Code

lemmy.ml

Destide@feddit.uk to Programmer Humor@lemmy.mlEnglish · 1 day ago
message-square
151
fedilink
alert-triangle
You must log in or register to comment.
  • Kuma@lemmy.world
    link
    fedilink
    arrow-up
    5
    arrow-down
    1
    ·
    2 hours ago

    I am more amazed that he didn’t stop at 10 and think “damn this is tiresome isn’t there a one liner i could do?”. I want to know how far he went. His stubbornness is amazing but also scary. I haven’t seen this kind of code since back in school lol lol lol

  • WraithGear@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    arrow-down
    1
    ·
    edit-2
    2 hours ago

    Would this be a case of modulo saving the day?

    Like: If Number modulo 2 = 0, true

    This has to be taken out of context

  • keepcarrot [she/her]@hexbear.net
    link
    fedilink
    English
    arrow-up
    3
    ·
    4 hours ago

    I want to assess coders by lines written! The more the better!

  • JackbyDev@programming.dev
    link
    fedilink
    English
    arrow-up
    32
    ·
    9 hours ago

    This is why this code is good. Opens MS paint. When I worked at Blizzard-

    • benjaminb@discuss.tchncs.de
      link
      fedilink
      English
      arrow-up
      5
      ·
      4 hours ago

      And he has Whatever+ years of experience in the game industry…

      • onlooker@lemmy.ml
        link
        fedilink
        arrow-up
        2
        ·
        2 hours ago

        Which sounds impressive until you realize a janitor who worked there for the same amount of time could claim the same.

  • Treczoks@lemmy.world
    link
    fedilink
    arrow-up
    5
    ·
    8 hours ago

    Good if you are rated by an AI that pays for LOCs.

  • kreskin@lemmy.world
    link
    fedilink
    arrow-up
    6
    arrow-down
    1
    ·
    9 hours ago

    no unit tests huh.

    /s

  • 6stringringer@lemmy.zip
    link
    fedilink
    arrow-up
    2
    ·
    8 hours ago

    Thanks to goodness, finally. A (giggle & snort) solid algorithm. There ya’s go set yer clocks & go get a haircut.

  • Drunk & Root@sh.itjust.works
    link
    fedilink
    arrow-up
    1
    ·
    9 hours ago

    this is like the making chess one

  • sik0fewl@lemmy.ca
    link
    fedilink
    arrow-up
    9
    arrow-down
    1
    ·
    14 hours ago

    This code would run a lot faster as a hash table look up.

    • PieMePlenty@lemmy.world
      link
      fedilink
      arrow-up
      5
      ·
      9 hours ago

      I agree. Just need a table of even numbers. Oh and a table of odd numbers, of course, else you cant return the false… duh.

    • Valmond@lemmy.world
      link
      fedilink
      arrow-up
      4
      ·
      9 hours ago

      In a Juliana tree, or a dictionary tree if you want. For speed.

  • redxef@feddit.org
    link
    fedilink
    arrow-up
    32
    ·
    18 hours ago
    def is_even(n: int) -> bool:
        if n < 0:
            return is_even(-n)
        r = True
        for _ in range(n):
            r = not r
        return r
    
    • dragonlobster@programming.dev
      link
      fedilink
      arrow-up
      2
      ·
      4 hours ago

      He loves me, he loves me not

    • vandsjov@feddit.dk
      link
      fedilink
      arrow-up
      1
      ·
      9 hours ago

      No, no, I would convert the number to a string and just check the last char to see if it was even or not.

  • Valmond@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    9 hours ago

    private?

  • Patches@ttrpg.network
    link
    fedilink
    arrow-up
    14
    ·
    17 hours ago

    Y’all laugh but this man has amazing code coverage numbers.

  • Clbull@lemmy.world
    link
    fedilink
    arrow-up
    20
    ·
    19 hours ago

    This is YandereDev levels of bad.

    • lime!@feddit.nu
      link
      fedilink
      English
      arrow-up
      6
      ·
      16 hours ago

      this is yanderedev.

      • Clbull@lemmy.world
        link
        fedilink
        arrow-up
        2
        ·
        15 hours ago

        Nah, this is yanderedev

        • lime!@feddit.nu
          link
          fedilink
          English
          arrow-up
          4
          ·
          9 hours ago

          no the code is

  • kamen@lemmy.world
    link
    fedilink
    arrow-up
    19
    ·
    20 hours ago

    Plot twist: they used a script to generate that code.

  • segfault11 [any]@hexbear.net
    link
    fedilink
    English
    arrow-up
    18
    ·
    19 hours ago

    pro hacker tip: you can optimize this by using “num” for the variable name instead of “number”

    • Patches@ttrpg.network
      link
      fedilink
      arrow-up
      4
      ·
      17 hours ago

      I prefer the cryptic each variable gets a single letter of the alphabet.

Programmer Humor@lemmy.ml

programmerhumor@lemmy.ml

remote_follow_modal_title

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programmerhumor@lemmy.ml

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.
community_visibility: public
globe

public_blurb

  • 731 users / day
  • 1.5K users / week
  • 3.1K users / month
  • 9.73K users / 6 months
  • number_of_local_subscribers
  • 37.2K subscribers
  • 1.79K Posts
  • 38.1K Comments
  • Modlog
  • mods:
  • AgreeableLandscape@lemmy.ml
  • cat_programmer@lemmy.ml
  • UI: unknown version
  • BE: 0.19.5
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org