import random
def play_game():
# Generate a random number between 1 and 100
secret_number = random.randint(1, 100)
# Get the maximum number of attempts from the player
max_attempts = int(input("Enter the maximum number of attempts: "))
# Start the game
attempts = 0
while attempts < max_attempts:
attempts += 1
guess = int(input("Enter your guess (1-100): "))
# Check if the guess is correct
if guess == secret_number:
print("Congratulations! You guessed the correct number.")
return
# Provide hints for the next guess
if guess < secret_number:
print("Guess higher.")
else:
print("Guess lower.")
# Display the number of remaining attempts
remaining_attempts = max_attempts - attempts
print(f"You have {remaining_attempts} attempt(s) remaining.")
# The player ran out of attempts
print("Game over. You did not guess the correct number.")
print(f"The secret number was: {secret_number}")
# Start the game
play_game()