Answered step by step
Verified Expert Solution
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
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:
points Write code which will do the following repeatedly, until the user correctly guesses the number :
Prompt the user to enter a guess.
Print one of the following messages, as appropriate: "Your guess is too sma or "Your guess is too large.", or "You guessed correctly"!
After the user has correctly guessed the number, congratulate them if they succeeded with maxguessesneeded 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
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