Hi
I've written a rock paper scissors game now want to code in 'Best of 3' logic. Right now, it plays 3 times and then exits.
Any advice will be appreciated. Thanks.
I've written a rock paper scissors game now want to code in 'Best of 3' logic. Right now, it plays 3 times and then exits.
Any advice will be appreciated. Thanks.
mychoice = [] for i in range(3): mychoice = input("Please enter your choice of rock, paper or scissors?\n").lower() while mychoice not in ["rock","paper","scissors"]: print("Please spell correctly.\n") mychoice = input("Please enter your choice of rock, paper or scissors?\n").lower() list = ["rock","paper","scissors"] import random compchoice = random.choice(list) print("Computer chose" + " - " + compchoice) if mychoice == compchoice: print("We chose the same things. Let's play again.\n") break if mychoice == 'rock' and compchoice == 'scissors': Result1 = "You win.\n" print(Result1) elif mychoice == 'rock' and compchoice == 'paper': Result2 = "I win.\n" print(Result2) if mychoice == 'paper' and compchoice == 'scissors': Result2 = "I win.\n" print(Result2) elif mychoice == 'paper' and compchoice == 'rock': Result1 = "You win.\n" print(Result1) if mychoice == "Scissors" and compchoice == 'paper': Result1 = "You win.\n" print(Result1) elif mychoice == "Scissors" and compchoice == 'rock': Result2 = "I win.\n" print(Result2) break