我想模拟一个石头剪刀布游戏,这就是我到目前为止所拥有的。它不允许我在scoregame
函数中输入字母。我怎样才能解决这个问题?
def scoregame(player1, player2):
if player1 == R and player2 == R:
scoregame = "It's a tie, nobody wins."
if player1 == S and player2 == S:
scoregame == "It's a tie, nobody wins."
if player1 == P and player2 == P:
scoregame = "It's a tie, nobody wins."
if player1 == R and player2 == S:
scoregame = "Player 1 wins."
if player1 == S and player2 == P:
scoregame = "Player 1 wins."
if player1 == P and player2 == R:
scoregame = "Player 1 wins."
if player1 == R and player2 == P:
scoregame == "Player 2 wins."
if player1 == S and player2 == R:
scoregame == "Player 2 wins."
if player1 == P and player2 == S:
scoregame = "Player 2 wins."
print(scoregame)