私は下のコードを書いていますが、すべてがうまく動作するようです。その答えは無効であると考えられます。私の論理が正しいように私は何が間違っているのか分かりません。私の「ロック、ペーパー、はさみ」コードで何かが間違っています
print("Welcome to Rock, Paper, Scissors!")
print("Let's Begin ...")
name1 = input("Player 1: What's your name?")
name2 = input("Player 2: What's your name?")
print("Hello " + name1 + " and " + name2)
print(name2 + ": Close your eyes!")
choice1 = input(name1 + ": enter 'r' for rock, 'p' for paper, and 's' for Scissors: ")
print("Great choice! Now - cover your answer and ask " + name2 + " to choose. \n\n\n")
choice2 = input(name2 + ": enter 'r' for rock, 'p' for paper, and 's' for scissors: ")
if(choice1 == "r" , choice2 == "p"):
print(name2 + " wins!")
elif(choice1 == "r" , choice2 == "s"):
print(name1 + " wins!")
elif(choice1 == "r" , choice2 == "r"):
print("It is a draw")
elif(choice2 == "r" , choice1 == "p"):
print(name1 + " wins!")
elif(choice2 == "r" , choice1 == "s"):
print(name2 + " wins!")
elif(choice1 == "p" , choice2 == "s"):
print(name2 + " wins!")
elif(choice1 == "p" , choice2 == "p"):
print("It is a draw!")
elif(choice2 == "p" , choice1 == "s"):
print(name1 + " wins!")
elif(choice1 == "s" , choice2 == "s"):
print("It is a draw!")
else:
print("Invalid asnwer")
print("Thanks for playing Rock, Paper, scissors")
を行うことができますか? – Soviut
論理は正しいですし、構文も...少なくともインタプリタによってエラーを引き起こさないように修正してください。 if文でカンマを見直して、コンパイルエラーが発生していると思われる場合があります。 –