私のプログラムがなぜ動かないのか分かりません。インデントされたブロックを予想しています。私は何回もインデントしなかったか、少ししかインデントしていないことを確認しましたが、問題を見つけることができません。誰も助けることができますか?お願いしてありがとう。インデントされたブロックが予想され、どこか理由がわからない
import random
userChoice = eval(input("Scissor (0), Rock (1), Paper (2)"))
computerChoice = random.randint(0,2)
if computerChoice == 0:
elif computerChoice == 1:
elif computerChoice == 2:
if userChoice == 0:
elif userChoice == 1:
elif userChoice == 2:
if userChoice == 0 and computerChoice == 0:
print("The computer is Scissors. You are Scissors. It's a tie!")
elif userChoice == 0 and computerChoice == 1:
print("The computer is Rock. You are Scissors. You lost")
elif userChoice == 0 and computerChoice == 2:
print("The computer is Paper. You are Scissors. You won!")
if userChoice == 1 and computerChoice == 0:
print("The computer is Scissors. You are Rock. You won!")
elif userChoice == 1 and computerChoice == 1:
print("The computer is Rock. You are Rock. It's a tie!")
elif userChoice == 1 and computerChoice == 2:
print("The computer is Paper. You are Rock. You lost")
if userChoice == 2 and computerChoice == 0:
print("The computer is Scissors. You are Paper. You lost")
elif userChoice == 2 and computerChoice == 1:
print("The computer is Rock. You are Paper. You won!")
elif userChoice == 2 and computerChoice == 2:
print("The computer is Paper. You are Paper. It's a tie!")
if/elif if文は空です。また、 'eval()'の代わりに 'int()'を使用してください。 – Li357
@AndrewL。こんにちはAndrew、もしあなたが/ elifの文が空であれば、どういう意味ですか?わかりません。 – DandyPotato
制御文を空にすることはできません。そのため、 'if ...:'の中に文がない場合は無効です –