import random import time player_wins = 0 cpu_wins = 0 while player_wins < 2 and cpu_wins < 2: print() print("Enter your choice:") print("[r]ock") print("[p]aper") print("[s]cissors") player_choice = str.lower(input()) cpu_choice = random.randint(1,3) if cpu_choice == 1: cpu_choice = "r" if cpu_choice == 2: cpu_choice = "p" if cpu_choice == 3: cpu_choice = "s" if player_choice == cpu_choice: print("tie") if player_choice == "p" and cpu_choice == "r": print("player win") player_wins = player_wins+1 if player_choice == "s" and cpu_choice == "p": print("player win") player_wins = player_wins+1 if player_choice == "r" and cpu_choice == "s": print("player win") player_wins = player_wins+1 if cpu_choice == "p" and player_choice == "r": print("cpu win") cpu_wins = cpu_wins+1 if cpu_choice == "s" and player_choice == "p": print("cpu win") cpu_wins = cpu_wins+1 if cpu_choice == "r" and player_choice == "s": print("cpu win") cpu_wins = cpu_wins+1 if player_wins == 2: print("You won the best of 3!") if cpu_wins == 2: print("You lost the best of 3!")