Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

( 1 ) ( 5 points ) At the top of your file, import the math and random modules. Use an input statement with a

(1)(5 points)
At the top of your file, import the math and random modules.
Use an input statement with a prompt, asking the user to enter a positive integer B. Following that code, insert the following:
(2)(20 points) Write code which will do the following repeatedly, until the user correctly guesses the number N :
Prompt the user to enter a guess.
Print one of the following messages, as appropriate: "Your guess is too sma11.", or "Your guess is too large.", or "You guessed correctly"!
After the user has correctly guessed the number, congratulate them if they succeeded with max_guesses_needed or fewer guesses. Chastise them if they used more than required. The program should then exit gracefully (you may not use break, or exit(), or similar - your loop should just naturally terminate

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

Data Management Databases And Organizations

Authors: Richard T. Watson

3rd Edition

0471418455, 978-0471418450

More Books

Students also viewed these Databases questions