import random #1 Guessing game defines the function for the entire project. def guessinggame(): #Asks for the player name player_name = input("Enter your name: ") #Welcomes player to the game and executes the game now print("Welcome to the guessing game, this will be played in 3 rounds, your objective is to guess a random number from 1 - 1000.") print(f"Hello {player_name}. Let's start now.") #Variables for the score count player_score = 0 computer_score = 0 rounds = 0 while rounds < 3: rounds += 1 print(f"\nRound {rounds}:") target_number = random.randint(1, 1000) guesses = 0 while guesses < 10: guesses += 1 guess = int(input("Guess the number (between 1 and 1000): ")) if guess == target_number: print("You WON!!!!") player_score += 1 break elif guess < target_number: print("Go higher") else: print("Go lower.") if guesses == 10: print(f"Sorry, you used up all of your guesses. The number was {target_number}.") computer_score += 1 print(f"Scores: {player_name}: {player_score}") if player_score == 2: print(f"You win!") break elif computer_score == 2: print("Unfortunately the computer won!!") break def main(): guessinggame() print("Thanks for playing!") if __name__ == "__main__": main()