シンプルなじゃんけんゲームを作成しようとしていますが、タイトルに指定されているエラーが常に発生します。これがコードです。21行目あたりでエラーが出ます。初心者なので比較的簡単に書いてください。
import random
def displayIntro():
print('Hello! This a game of Rock, Paper, Scissors, against the computer.')
print()
def humanChoice():
playerChoice = ''
while playerChoice != 'Rock' and playerChoice != 'Paper' and playerChoice != 'Scissors':
print('Please choose: Rock, Paper or Scissors. BTW: Please type your choice with the first letter as a capital.')
playerChoice = input()
return playerChoice
a = ["Rock", "Paper", "Scissors"]
def computerChoice():
compChoice = random.choice(a)
def winner():
if playerChoice == compChoice:
print('You tied! The computer also chose ' + playerChoice)
elif playerChoice == Rock and compChoice == Scissors:
print('You won! You chose ' + playerChoice + ' and the computer chose ' +compChoice)
elif playerChoice == Paper and compChoice == Rock:
print('You won! You chose ' + playerChoice + ' and the computer chose ' +compChoice)
elif playerChoice == Scissors and compChoice == Paper:
print('You won! You chose ' + playerChoice + ' and the computer chose ' +compChoice)
else:
print('You lost! You chose ' + playerChoice + ' and the computer chose ' +compChoice)
playAgain = 'yes'
while playAgain == 'yes' or playAgain == 'Yes':
displayIntro()
humanChoice()
computerChoice()
winner()
print('Do you want to play again? (yes or no)')
playAgain = input()