if player1 == "Rock":
if player2 == "Paper":
print("Player 2 Wins!")
elif player2 == "Scissors":
print("Player 1 Wins!")
elif player2 == "Rock":
print("Draw")
elif player1 == "Paper":
# Same overall format different output
elif player1 == "Scissors":
# Same overall format different output
else:
print("You must choose Rock, Paper, or scissors")
你缺少合乎逻辑的案例。你需要把玩家1和玩家2的所有情况都包括在内
另一个简化逻辑的方法是建立一个预计算结果的字典
使用上面的代码,您可以按照
为了完整:
相关问题 更多 >
编程相关推荐