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.")
And Windows nowadays have like dozen of different security measures that stop you from removing critical system components. It is not like in Windows 95 days, that OS allowed you to remove kernel by just typing a single command.
Omg someone please help how did I get this far they're going to realize I'm stupid when they fire me everything will collapse because it's all in a single excel file I need to figure out how to live in a tent in the woods and hunt and forage
This behavior is useful when debugging: if an escape sequence is mistyped, the resulting output is more easily recognized as broken.
Wow, this sentence really threw me for a moment. I had no idea how other programming languages behave.
...which makes sense, because they don't. The compiler just tells you to fuck off and that's the end of that story. I guess, they can't do that in Python...
It's the late 90s. My mother suddenly discovers File Explorer on her refurbished commodity Wintel box and decides that all this messy clutter has to go. Never mind that the drive was 80% empty when delivered and I didn't expect her to come close to filling it before it was replaced. Fortunately I had already backed up everything that looked important or interesting.
One day she calls from the office, "I don't need this 'Windows' any more, do I?"
"What? Wait! Don't do anything!" I walk in and she's got C:/Windows highlighted and the cursor is hovering over "Delete".
"I already have Windows installed on this computer, so I don't need this any more, do I?" Spoken more as a statement than a question. It took several minutes of forced calm explanation to get her to accept that this "Windows" directory WAS the Windows that's installed on the machine. She still wasn't happy that she could see it in File Explorer, though. So untidy!
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.
Revolvers don't have the concept of one-in-the-chamber, only semi-auto pistols do, and you can't play russian roulette with semi-autos :P (well you could, but 99% of the time, barring unexpected jams, the first person to go would lose)
Anyway I'm guessing it's a bug :) - as the saying goes "no code is too short to be bug-free"