""" ------------------------------------------------- Project: Take-Away Game Standard: 91883 (AS1.7) v.1 School: Tauranga Boys' College Author: Sean Lois Bencio Date: 7/03/2025 Python: 3.5 ------------------------------------------------- """xx x import random reset_guesses = 0 rounds = 3 user_score = 0 ai_score = 0 round_won = True round_number = 1 print("Take-Away Game") name = input("What is your name? ") print("Hello ", name, ", it is now time to guess a number. You will only get 10 guesses per round.") while round_number <= rounds: print("\nRound ", round_number, " begins!") secret_number = random.randint(1, 1000) attempts = 10 for attempt in range(1, attempts + 1): guess = input("Attempt " + str(attempt) + "/" + str(attempts) + ": Enter your guess: ") if not guess.isdigit(): print("Invalid input! Please enter a number.") continue guess = int(guess) if guess == secret_number: print("Congratulations, ", name, "! You guessed the number in ", attempt, " attempts.") user_score += 1 break elif guess < secret_number: print("Too low! Try a higher number.") else: print("Too high! Try a lower number.") else: print("Sorry,", name, ". You've used all", attempts, "attempts. The correct number was ", secret_number, ".") ai_score += 1 print("Current Score: ", name, " - ", user_score, ", Computer - ", ai_score) if user_score == 2: print("\nCongratulations ", name, ", you won the game!") break elif ai_score == 2: print("\nGame Over! The computer wins this time.") break round_number += 1 print("\nFinal Score: ", name, " - ", user_score, ", Computer - ", ai_score) print("Thanks for playing!")