Я хочу сделать игру с ножницами рок -бумаги в качестве новичка Python, и у меня возникла проблема, когда я хочу, чтобы игроки были проверены на списке, которые выиграли, которые выиграли на основе своего выбора, так что рок, бумага выигрывает и т. Д."""rock paper scisiors is a game of random outcomes between 2 players
they have 3 choices and they all beat each other in different ways
rock beats scissors, paper beats rock, scissors beats paper
players can choose the same object that would equal a draw and lead
to an automatic repeat of the game
it is usually best 2/3 to win the game"""
import time
PlayerOne = input("Player One what is your name : ")
PlayerTwo = input("Player Two what is your name : ")
options = ["Rock","Paper","Scissors"]
RockWins = ["rock","scissors"]
PaperWins = ["rock","paper"]
ScissorsWins = ["scissors","paper"]
P1Option = []
P2Option = []
def rockPaperScissors(first, second):
print(f"Hi {PlayerOne} and {PlayerTwo} we will now begin a game of Rock Paper Scissors")
P1Option = input(f" {PlayerOne} Choose your weapon!")
P2Option = input(f" {PlayerTwo} Choose your weapon!")
first = P1Option
second = P2Option
time.sleep(1)
print("Rock")
time.sleep(1)
print("Paper")
time.sleep(1)
print("Scissors")
time.sleep(2)
print(f"{PlayerOne} has chosen {first} and {PlayerTwo} has chosen {second}")
Descision = [P1Option,P2Option]
if Descision is RockWins:
print("Rock Wins")
elif Descision is PaperWins:
print("Paper Wins")
else:
print("Scissors Wins")
print(Descision)
rockPaperScissors(P1Option,P2Option)
Подробнее здесь: https://stackoverflow.com/questions/795 ... an-outcome
Как сравнить один список с другим, используя оператор IF для достижения результата [дублировать] ⇐ Python
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение