Question: You are tasked with creating a number guessing game in Python. The program should be named guess.py . In this game, the computer generates a
You are tasked with creating a number guessing game in Python. The program should
be named guess.py
In this game, the computer generates a random number between and
inclusive and the player needs to guess the number within a limited number of
attempts based on their chosen difficulty level: easy attempts medium
attempts or difficult attempts
The game provides feedback to the player after each guess, indicating whether
the guess is too high, too low, or correct.
Your task is to write a Python program that implements this game. Follow these
guidelines:
o Create a function generaterandomnumber that generates a random
number between and and returns it
o Create a function playgamemaxattempts that implements the game
loop using while :
o Inside the loop, ask the player for their guess, compare it to the random
number, and provide feedback.
o If the guess is correct, break out of the loop.
o If the player exceeds the specified number of attempts for their chosen
difficulty level, break the loop and inform the player that they have failed.
o Display a message to the player when they guess the correct number,
along with the number of attempts it took.
o Use conditionals to check whether the guess is too high or too low and
provide appropriate feedback.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
