monyet.cc
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
Destide to Programmer Humor@lemmy.mlEnglish • 12 days ago

Infallible Code

lemmy.ml

message-square
165
fedilink
460

Infallible Code

lemmy.ml

Destide to Programmer Humor@lemmy.mlEnglish • 12 days ago
message-square
165
fedilink
  • @kryptonianCodeMonkey@lemmy.world
    link
    fedilink
    21•
    edit-2
    12 days ago
    def is_even(num):
        if num == 1:
            return False
        if num == 2:
            return True
        raise ValueError(f'Value of {num} out of range. Literally impossible to tell if it is even.')
    • @VitabytesDev@feddit.nl
      link
      fedilink
      6•
      edit-2
      11 days ago
      def is_even(num):
          num = num & 1
          if num == 0:
              return False
          if num == 1:
              return True
          raise ValueError(f'what the fuck')
      

      EDIT: forgor to edit the numbers

      • @kryptonianCodeMonkey@lemmy.world
        link
        fedilink
        9•12 days ago

        If you’re waiting for “num & 1 == 2”, you’re going to be very disappointed

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.
  • 93 users / day
  • 705 users / week
  • 2.82K users / month
  • 9.07K users / 6 months
  • 37.4K subscribers
  • 1.82K Posts
  • 39.1K Comments
  • Modlog
  • mods:
  • @AgreeableLandscape@lemmy.ml
  • @cat_programmer@lemmy.ml
  • BE: 0.19.3
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org