Advertisement
pbkb112

Русская рулетка

Nov 22nd, 2023 (edited)
942
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. # Russian Roulette game made in python. The rules are simple: Each player has to press enter to pull the trigger
  2. # and the player that hits the chambers that contains the bullet, losses!
  3.  
  4.  
  5. # After the game is over the user has the option to restart the game.
  6.  
  7. import random
  8.  
  9. while True:
  10. chambers = input("Please enter the number of chambers (default = 6): ")
  11.  
  12. if not chambers:
  13. chambers = 5
  14.  
  15. elif not chambers.isdigit():
  16. quit("Invalid number of chambers!")
  17.  
  18. fatal_bullet = random.randint(1, int(chambers))
  19.  
  20. for x in range(1, int(chambers) + 1):
  21. input("Press enter to pull the trigger! ")
  22. if x == fatal_bullet:
  23. print("You just got served!")
  24. print("Game Over")
  25. break
  26. print("You will live to see another day")
  27.  
  28. start_again = input("Do you want to start again? (y/n): ")
  29. if start_again and start_again.lower()[0] != "y":
  30. break
  31.  
  32. # For more scripts: https://drive.google.com/drive/folders/1thBhACRzWCMbaPogfAbpaMTB4dZ32GTO?usp=drive_link
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement