• unalivejoy
    link
    fedilink
    English
    6210 months 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.")
    
      • @saroh
        link
        1510 months ago

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

        • Billegh
          link
          1010 months ago

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

      • @finestnothing
        link
        310 months 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

      • @[email protected]
        link
        fedilink
        English
        110 months 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.