Question: (a) Write a python program that (1) asks the user to think of a number from 1 to infinity and (2) then guesses the number

 (a) Write a python program that (1) asks the user to

(a) Write a python program that (1) asks the user to think of a number from 1 to infinity and (2) then guesses the number using the efficient algorithm described in class (see slide 15 in 3-Recurrences). Assume the user will respond "low", "high", or "correct" after each computer guess. Start your code like this: # Author: # Purpose: guess the user's number print("Think of a number between 1 and infinity.") guess = 2 nbrGuesses = 1 response=input("Is it " + str(guess)) while response!= "correct": CSC 375 Homework 2 Spring 2020 if response == "low": # TODO: FILL in this part if response == "high": #TODO: FILL in this part print("Your number is", guess) print("It took", nbrGuesses, "guesses")

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!