lemmy.mlaga97.space
  • Communities
  • Create Post
  • Create Community
  • 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
140
fedilink
1

Infallible Code

lemmy.ml

Destide@feddit.uk to Programmer Humor@lemmy.mlEnglish · 1 day ago
message-square
140
fedilink
alert-triangle
You must log in or register to comment.
  • WraithGear@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    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

  • Kuma@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    3 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

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

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

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

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

  • Treczoks@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    9 hours ago

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

  • JackbyDev@programming.dev
    link
    fedilink
    English
    arrow-up
    0
    ·
    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
      0
      ·
      5 hours ago

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

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

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

  • kreskin@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    10 hours ago

    no unit tests huh.

    /s

  • sik0fewl@lemmy.ca
    link
    fedilink
    arrow-up
    0
    ·
    14 hours ago

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

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

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

    • PieMePlenty@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      10 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.

  • thatradomguy@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    16 hours ago

    Can you imagine being a TA and having to grade somebody’s hw and you get this first thing? lmao

  • xorollo@leminal.space
    link
    fedilink
    arrow-up
    0
    ·
    17 hours ago

    This joke was not written by the dude pictured. The author wrote a book of funny code jokes.

  • last_philosopher@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    17 hours ago

    To be fair, the question is “Write a function that simultaneously determines if the number is even and works as a timer”

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

      sleepSort meets sleepIsEven

  • Patches@ttrpg.network
    link
    fedilink
    arrow-up
    0
    ·
    18 hours ago

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

  • Packet [none/use name]@hexbear.net
    link
    fedilink
    arrow-up
    0
    ·
    18 hours ago

    The end user yearns for their machine to be utilized fully, so instead of that, you can import full deepseek model to do the task

  • redxef@feddit.org
    link
    fedilink
    arrow-up
    0
    ·
    19 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
      0
      ·
      4 hours ago

      He loves me, he loves me not

  • ferric_carcinization@lemmy.ml
    link
    fedilink
    English
    arrow-up
    0
    ·
    19 hours ago

    I hope that the language’s ints are at most 32 bits. For 8 bits it could even be written by hand & the source code for a 32 bit version would only take up avg_line_len * 4GiB space for the source code of the function. But it might take a bit of time to compile a version that supports the full range of 64 or 128 bit ints.

    • Patches@ttrpg.network
      link
      fedilink
      arrow-up
      0
      ·
      18 hours ago

      My mate, Paul, says all numbers after 700 repeat, we just give them different names so you think they’re going up.

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

      all you have to to is throw an exception if the number is bigger than 100, who even needs numbers that big anyways?

Programmer Humor@lemmy.ml

programmerhumor@lemmy.ml

Subscribe from Remote Instance

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.
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 118 users / day
  • 159 users / week
  • 370 users / month
  • 1.52K users / 6 months
  • 0 local subscribers
  • 37.2K subscribers
  • 1.6K Posts
  • 22.3K Comments
  • Modlog
  • mods:
  • AgreeableLandscape@lemmy.ml
  • cat_programmer@lemmy.ml
  • BE: 0.19.5
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org