Question: To practice a simple loop and simple conditionals For this question, you ll write a simple program that makes the user try to guess a
To practice a simple loop and simple conditionals
For this question, youll write a simple program that makes the user try to guess a secret number repeatedly
until they get it right.
First, your program should select a random number between and inclusive You can use the randint
method from the random module to do this. This is the secret number that the user is trying to guess.
Then, your program should allow the user to input numbers as many times as needed in order to guess the
secret number. If the user gets it wrong, the program should give a hint by telling the user whether their
guess was too high or too low. If the user gets it right, the program should tell them so and then terminate.
Sample Run
Sample input and output input typed by the user is shown in green text:
Guess a number from to
Too low
Guess again :
You got it the secret number was
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
