Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions