-
Notifications
You must be signed in to change notification settings - Fork 1
/
russian_roulette.py
31 lines (23 loc) · 962 Bytes
/
russian_roulette.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Russian Roulette game made in python. The rules are simple: Each player has to press enter to pull the trigger
# and the player that hits the chambers that contains the bullet, losses!
# After the game is over the user has the option to restart the game.
import random
import os
import sys
chambers = input("Please enter the number of chambers (default = 6): ")
if not chambers:
chambers = 5
elif not chambers.isdigit():
quit("Invalid number of chambers!")
fatal_bullet = random.randint(1, int(chambers))
for x in range(1, int(chambers) + 1):
input("Press enter to pull the trigger! ")
if x == fatal_bullet:
print("You just got served!")
print("Game Over")
start_again = input("Do you want to start again? (y/n): ")
if start_again and start_again.lower()[0] == "y":
os.execv(sys.executable, [sys.executable] + sys.argv)
else:
break
print("You will live to see another day")