• mox@lemmy.sdf.org
    link
    fedilink
    arrow-up
    1
    ·
    9 months ago

    Perfectly safe on Windows, too. The remove() function doesn’t work on directories.

  • unalivejoy@lemm.ee
    link
    fedilink
    English
    arrow-up
    1
    ·
    9 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.")
    
  • random9@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    9 months ago

    isn’t randint range inclusive? thus random.randint(0, 6) == 1 has a 1 in 7 chance, not 1 in 6. Most revolvers, assuming this is emulating russian roulette, have 6 cylinders, not 7.