import random round = 1 psco = 0 csco = 0 name = input("What is your name: ") print("Hello", name, "welcome to the guessing game") while True: play = input("Do you want to play? (y/n): ") if play.lower() != "y": break answer = random.randint(1, 1000) guessTIMES = 10 print("Round", round) while guessTIMES > 0: try: guess = int(input("Pick a number between 1 - 1000: ")) except ValueError: print("Please enter a valid number.") continue if guess == answer: print("You are correct!") psco += 1 break elif guess > answer: print("Lower") else: print("Higher") guessTIMES -= 1 if guessTIMES == 0: print("You lose") print("The answer was", answer) csco += 1 break print("Score -", name + ":", psco, "Computer:", csco) round += 1 print("Game Over") if psco > csco: print("Congratulations! You beat the computer!") elif psco == csco: print("It's a tie!") else: print("Better luck next time!")