Question: Write a python program in which the computer thinks of a random number from 1 to 2 0 and askes you to guess it .
Write a python program in which the computer thinks of a random number from to and askes you to guess it The computer will tell you if each guess is too high or too low. You win if you can guess the number within five tries. As closely as possible, follow the examples below.
Import the radint function from the random library. See Unit pointsHint: use randint
Prompt for the user's name. pointsHint: use an input statement
Display a greeting with the user's name and the number of guesses. pointsHint: use a print statement
Have the computer generate a random number between and See Unit pointsHint: use randint
Play the game for rounds. pointsHint: use a FOR or a While Loop
Prompt the user for a guess. pointsHint use an input statement and convert input to an integer
If the guess is greater than the random number, print a message. pointsHint: use an IF statement and a print statement
If the guess is less than the random number, print a message. pointsHint: use an IF statement and a print statement
If the guess is equal to the random number, print a message with the user name and the number of guesses used. The game ends. pointsHint: use an IF statement and a print statement
If the user exceeds the number of guesses, print a message with the random number. The game ends. pointsHint: use an IF statement and a print statement
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
