schlunker
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
nifty@lemmy.world to Programmer Humor@programming.dev · 1 year ago

More believable for a Linux OS

lemmy.world

message-square
41
fedilink
357

More believable for a Linux OS

lemmy.world

nifty@lemmy.world to Programmer Humor@programming.dev · 1 year ago
message-square
41
fedilink
  • unalivejoy@lemm.ee
    link
    fedilink
    English
    arrow-up
    65
    arrow-down
    1
    ·
    1 year ago

    You call that russian roulette? This is real russian roulette. Dying is a 1/6 probability.

    #!/usr/bin/env python3
    import random
    
    barrel = [0, 0, 0, 0, 0, 1]
    random.shuffle(barrel)
    
    print("Russian Roulette")
    for i in barrel:
      input("Press enter to shoot")
      if i == 1:
        print("You are dead.")
        exit()
      else:
        print("Phew. You survived.")
    
    • librecat@lemmy.basedcount.com
      link
      fedilink
      arrow-up
      24
      arrow-down
      4
      ·
      1 year ago

      I love this, except for i i hate i.

      • saroh@lemmy.world
        link
        fedilink
        arrow-up
        16
        ·
        1 year ago

        And maybe the fact that you have to continue until the gun actually fires :|

        • Billegh@lemmy.world
          link
          fedilink
          arrow-up
          10
          ·
          1 year ago

          You can quit control-c at any point. Sometimes, the game plays you.

      • problematicPanther@lemmy.world
        link
        fedilink
        arrow-up
        11
        ·
        1 year ago

        but it’s easier than thinking of a useful variable name.

        • Kogasa@programming.dev
          link
          fedilink
          arrow-up
          5
          ·
          1 year ago

          bullet_idx

        • Iapar@feddit.de
          link
          fedilink
          arrow-up
          3
          ·
          1 year ago

          Like bullet?

      • finestnothing@lemmy.world
        link
        fedilink
        arrow-up
        3
        ·
        1 year ago

        I always use i because I’m too lazy to type out iterator when I’m making my garbage spaghetti code that will support infrastructure for years

      • faintwhenfree@lemmus.org
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

        I like it, i for int easy to remember. I also use i, j, k as u it vectors and remember at what depth of a multidimentional array in working at.

      • DeepGradientAscent@programming.dev
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        1 year ago

        Removed by mod

    • winky9827b@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      You forgot the switch.

Programmer Humor@programming.dev

programmer_humor@programming.dev

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: !programmer_humor@programming.dev

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics
Visibility: Public
globe

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

  • 2.23K users / day
  • 4.62K users / week
  • 9.29K users / month
  • 17.8K users / 6 months
  • 1 local subscriber
  • 23.1K subscribers
  • 1.39K Posts
  • 51.2K Comments
  • Modlog
  • mods:
  • Feyter@programming.dev
  • adr1an@programming.dev
  • BurningTurtle@programming.dev
  • Pierre-Yves Lapersonne@programming.dev
  • BE: 0.19.5
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org