Question: 9 . 6 Random Number Guessing Game ( No User Input ) In this assignment, you will create a Python program that generates a random

9.6 Random Number Guessing Game (No User Input)
In this assignment, you will create a Python program that generates a random number with a seed value and provides hints to the user. Your goal is to determine the random number based on the provided hints. This modified version of a guessing game doesn't require user input but simulates the guessing process for you.
Task:
Your program should complete the following tasks:
Import the random module to enable random number generation.
Set a seed value of your choice using the random.seed() function for reproducibility.
Generate a random integer between 1 and 10(inclusive) and store it in a variable target_number.
Simulate a guessing game without user input. Provide the following hints to help you determine the random number:
"The number is lower than 5." if the number is less than 5. "The number is higher than 5." if the number is greater than 5. "You guessed correctly!" if you correctly guess the number. Print a congratulatory message after you guess the correct number and the number of attempts it took you to guess correctly.
Instructions:
Start by importing the random module to enable random number generation.
Set a seed value to 42 using random.seed() to ensure reproducibility.
Generate a random integer between 1 and 10 and store it in the target_number variable. This is the number you'll try to guess.
The program will simulate a guessing game for you. It will generate random guesses and provide hints based on those guesses.
The goal is to guess the target_number based on the provided hints. When you guess correctly, the program will congratulate you and tell you how many attempts it took.
Example Output:
Welcome to the Random Number Guessing Game!
Hint: The number is higher than 1
Hint: The number is lower than 5
Hint: The number is lower than 4
Hint: The number is lower than 4
Hint: The number is lower than 3
You guessed correctly! Congratulations! You determined the number.
Number of attempts: 6

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!