Question: The codes below can be used to randomly generate an integer number i between the range of 1 and 10 (inclusive). import random irandom.randint
The codes below can be used to randomly generate an integer number i between the range of 1 and 10 (inclusive). import random irandom.randint (1,10) Write a integer number guessing game program, which allows a user to guess the randomly generated number within 5 tries. If user enters a wrong number, display hints, such as the guessed the number is too low or too high to the user. If user enters a correct number, user is considered to have won the game, and "You win with x tries" (x is the total number of tries that the user takes to win the game) message is displayed. If within 5 tries, user is still not able to guess the correct number, user is considered to have lost the game, and "You lose" is displayed. Example of how the game program can run is as follow. Enter a number (1-10] : 5 Your guessed number is too low. Enter a number [1-10] : 7 Your guessed number is too low. Enter a number [1-10] : 9 You win with 3 tries.
Step by Step Solution
There are 3 Steps involved in it
import random def numberguessinggame num randomrandint1 10 tr... View full answer
Get step-by-step solutions from verified subject matter experts
