Advertisement
plarmi

Камень, ножницы, бумага

Dec 10th, 2023 (edited)
651
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.14 KB | None | 0 0
  1. from random import *
  2.  
  3. player = int(input("Сделайте ваш выбор (камень - 0, ножницы - 1, бумага - 2): "))
  4. if player == 0:
  5.     print("Выбор игрока: камень")
  6. elif player == 1:
  7.     print("Выбор игрока: ножницы")
  8. elif player == 2:
  9.     print("Выбор игрока: бумага")
  10.  
  11. computer = randint(0, 2)
  12.  
  13. if computer == 0:
  14.     print("Выбор компьютера: камень")
  15. elif computer == 1:
  16.     print("Выбор компьютера: ножницы")
  17. elif computer == 2:
  18.     print("Выбор компьютера: бумага")
  19.  
  20. if player == computer:
  21.     print("Ничья")
  22. elif player == 0:
  23.     if computer == 2:
  24.         print("Победил компьютер")
  25.     elif computer == 1:
  26.         print("Победил игрок!")
  27. elif player == 1:
  28.     if computer == 0:
  29.         print("Победил компьютер")
  30.     elif computer == 2:
  31.         print("Победил игрок!")
  32. elif player == 2:
  33.     if computer == 1:
  34.         print("Победил компьютер")
  35.     elif computer == 0:
  36.         print("Победил игрок!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement