this post was submitted on 19 Feb 2024
355 points (94.9% liked)

Programmer Humor

19187 readers
1173 users here now

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

founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 64 points 7 months ago (10 children)

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.")
[–] [email protected] 20 points 7 months ago (8 children)

I love this, except for i i hate i.

[–] [email protected] 16 points 7 months ago (1 children)

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

[–] [email protected] 10 points 7 months ago

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

load more comments (6 replies)
load more comments (7 replies)