import random

def guess_number_game():
score = 0
num_guesses = 5

for _ in range(num_guesses):
# Generate a random number between 1 and 10
random_number = random.randint(1, 10)

# Ask the user for their guess
user_guess = int(input(f"Guess the number (between 1 and 10): "))

# Check if the user's guess is correct
if user_guess == random_number:
print("Correct! You earn 10 points.")
score += 10
else:
print(f"Sorry, the correct number was {random_number}. You lose 1 point.")

print(f"Game Over. Your final score is: {score} points")

if __name__ == "__main__":
guess_number_game()



Guess the number (between 1 and 10): 5
Correct! You earn 10 points.
Guess the number (between 1 and 10): 8
Sorry, the correct number was 4. You lose 1 point.
Guess the number (between 1 and 10): 3
Sorry, the correct number was 9. You lose 1 point.
Guess the number (between 1 and 10): 1
Sorry, the correct number was 7. You lose 1 point.
Guess the number (between 1 and 10): 10
Correct! You earn 10 points.
Game Over. Your final score is: 18 points


In this program, the user is asked to guess five random numbers between 1 and 10, and their score is calculated based on their guesses. The program prints the user's final score after all guessing is complete.