Question: Python Guessing Game I m thinking of a number between 1 and 1 0 0 . . . What is it ? Implement a program

Python Guessing Game
Im thinking of a number between 1 and 100...
What is it?
Implement a program that:
Prompts the user for a level, n. If the user does not input a positive integer, the program should prompt again.
Randomly generates an integer between 1 and n, inclusive, using the random module.
Prompts the user to guess that integer. If the guess is not a positive integer, the program should prompt the user again.
If the guess is smaller than that integer, the program should output Too small! and prompt the user again.
If the guess is larger than that integer, the program should output Too large! and prompt the user again.
If the guess is the same as that integer, the program should output Just right! and exit.
Must include comments with your name, date, program name, and program purpose.
[Hints]
How to Test
Heres how to test your code manually:
Run your program. Type cat at a prompt that says Level: and press Enter. Your program should reprompt you:
Level:
Run your program. Type -1 at a prompt that says Level: and press Enter. Your program should reprompt you:
Level:
Run your program. Type 10 at a prompt that says Level: and press Enter. Your program should now be ready to accept guesses:
Guess:
Run your program. Type 10 at a prompt that says Level: and press Enter. Then type cat. Your program should reprompt you:
Guess:
Run your program. Type 10 at a prompt that says Level: and press Enter. Then type -1. Your program should reprompt you:
Guess:
Run your program. Type 1 at a prompt that says Level: and press Enter. Then type 1. Your program should output:
Just right!
Theres only one possible number the answer could be!
Run your program. Type 10 at a prompt that says Level: and press Enter. Then type 100. Your program should output:
Too large!
Looks like youre guessing outside the range you specified.
Run your program. Type 10000 at a prompt that says Level: and press Enter. Then type 1. Your program should output:
Too small!
Most likely, anyways: you might get lucky and see Just right!. But it would certainly be odd for you to see Just right! every time. And certainly you shouldnt see Too large!.

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 Databases Questions!