I am trying to create a little Rock paper scissors game as I am a beginner but I am having issues with my if and elif statements.
'''
import random
player_score = 0
computer_score = 0
options = ['rock', 'paper', 'scissors']
def player_choice():
input('Rock, Paper or Scissors? ')
return player_choice
def computer_choice():
print(random.choice(options))
return computer_choice
ps = print('player score: ', player_score)
cs = print('computer_score: ',computer_score)
while player_score or computer_score < 10:
player_choice()
computer_choice()
if player_choice == 'rock' and computer_choice == 'rock':
print('Tie')
elif player_choice == 'rock' and computer_choice == 'paper':
print('Computer wins')
computer_score = computer_score + 1
print(ps)
print(cs)
elif player_choice == 'rock' and computer_choice == 'scissors':
print('You win')
player_score = player_score + 1
print(ps)
print(cs)
'''
It seems as though the entire if/ elif block is ignored and nothing prints or is incremented. No error pops up, it is just simply ignored.
Aucun commentaire:
Enregistrer un commentaire