How do I keep a count of user vs computer wins and print it as i quit in the end

import random
def new_game():
option = [“rock”,“paper”,“scissors”]
computer = random.choice(option)
player_wins = 0
comp_wins = 0
while True:
player = input("Enter rock/paper/scissors: ").lower()
if player in option:
break
else:
continue
print("computer picks: ",computer)
if player == computer:
print(“DRAW”)
elif player==“rock” and computer == “scissors”:
print(‘YOU WIN’)
player_wins+=1
elif player==“paper” and computer == “rock”:
print(‘YOU WIN’)
player_wins+=1
elif player==“scissors” and computer == “paper”:
print(‘YOU WIN’)
player_wins+=1
else:
print(‘YOU LOSE’)
comp_wins+=1

new_game()

while True:
play_again = input(“Do you want to play again(Yes/No): “).capitalize()
print(”--------------------------------------”)
if play_again == “Yes”:
new_game()
continue
else:
print(“bubyee”)
quit()

2 Likes

@amoghrane56
Correct :100:
And in the last you can also use sys.exit()

2 Likes