Я пытаюсь сделать так, чтобы, когда пользователь или бот выигрывали раунд, они получали очко, но в конце игры, кажется, не добавляется, когда один или другой делает это правильно, я попробовал другой way ('x = x + 1'), также оцените мой код и скажите, что я мог бы сделать лучше.
import random
print('Lets play Rock Paper Scissors')
for tries in range (1,4):
try:
user_guess = input('Rock Paper Scissors? ')
choices = ['Rock','Paper','Scissors']
user_point = 0 #To keep track of the points
bot_point = 0
bot_guess = random.choice(choices) #Will randomly pick from the list 'choices'
while user_guess not in choices:#if the user tries to put in anything other then the choices given
print('Please enter the choices above!')
user_guess = input('Rock Paper Scissors? ')
except ValueError:
print('Please choose from the choices above ') #Just in case user tries to put a different value type
user_guess = input('Rock Paper Scissors? ')
DEBUG = "The bot did " + bot_guess
print(DEBUG)
if user_guess == bot_guess:
print('Tie!')
elif user_guess == "Rock" and bot_guess == "Paper":
print('The bot earns a point!')
bot_point += 1
elif user_guess == 'Paper' and bot_guess == "Rock":
print('The user earns a point!')
user_point += 1
elif user_guess == 'Paper' and bot_guess == 'Scissors':
print('The bot earns a point')
bot_point += 1
elif user_guess == 'Scissors' and bot_guess == 'Paper':
print('The user earns a point')
user_point += 1
elif user_guess == 'Rock' and bot_guess == 'Scissors':
print('The user earns a point')
user_point += 1
elif user_guess == 'Scissors' and bot_guess == 'Rock':
print('The bot earns a point')
bot_point += 1
print('After ' + str(tries) + ' tries. ' + ' The score is')
print('The User: ' + str(user_point))
print('The Bot: ' + str(bot_point))
if user_point > bot_point:
print('THE USER IS THE WINNER!!!')
else:
print('THE BOT IS THE WINNER!!!')