2020-12-29

Python: computer choice isnt showing up

Hi so im tryin to make a game that makes a player guess their computers choice, but the problem im facing is that, i stopped getting error, ((guess the computers choice between 1-10)) kept getting repeated even though i inputted my answer.

enter code here

import random 

def displayIntro():
print('guess the computer's choice from 0-10 ')
print()

def playerchoice():
player = ''
while player != (1,2,3,4,5,6,7,8,9,0):
    player = input()
    print('guess the computers choice between 1-10')
return player

def computerAnswer():
return random.choice([1,2,3,4,5,6,7,8,9,0])

def victory(computerAnswer, player):
if computerAnswer == player:
    print('congradulations you have guessed the computers choice:' + player)
else:
    print('oh no, better luck next time. Computer chose: ' + computerAnswer)

playAgain = 'yes'
while playAgain in ('yes', 'Yes'):
displayIntro()
player = playerchoice()
computerAnswer = computerAnswer()
victory(player, computerAnswer)

print('Do you want to play again? (yes or no)')
playAgain = input()


from Recent Questions - Stack Overflow https://ift.tt/38GGrGv
https://ift.tt/eA8V8J

No comments:

Post a Comment