Question
Using Python with while loops Write a Python program that 1) generates a random number n (an integer) between 0 and 100, inclusive, and 2)
Using Python with "while loops"
Write a Python program that 1) generates a random number n (an integer) between 0 and 100, inclusive, and 2) iteratively prompts the user to "guess" the number (the guess should be in the interval [0,100]) until they guess the correct number (n). After each guess, if the number is correctly guessed, print to the console "You found the number in M guesses!" (replace M with the actual number of guesses made). If the guess is greater than n, print to the console "Your guess is too high", and if the guess is less than n, print to the console "Your guess is too low". In the latter two cases you should prompt the user to enter an additional guess. Repeat until the number (n) is correctly guessed.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started