You forgot the switch.
Comment on More believable for a Linux OS
joyjoy@lemm.ee 10 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.")
winky9827b@lemmy.world 10 months ago
librecat@lemmy.basedcount.com 10 months ago
I love this, except for
i
i hatei
.saroh@lemmy.world 10 months ago
And maybe the fact that you have to continue until the gun actually fires :|
bhamlin@lemmy.world 10 months ago
You can
quitcontrol-c at any point. Sometimes, the game plays you.problematicPanther@lemmy.world 10 months ago
but it’s easier than thinking of a useful variable name.
kogasa@programming.dev 10 months ago
bullet_idx
Iapar@feddit.de 10 months ago
Like bullet?
finestnothing@lemmy.world 10 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