Question: Smart Guessing Game Programming Language: Python 3 For this program, you will need to use the given code and make add the following requirements: -The

Smart Guessing Game

Programming Language: Python 3

For this program, you will need to use the given code and make add the following requirements:

-The program before was asking the user to guess the number, but now the goal is to create a program where the computer will use the binary search algorithm to autonomously do the guessing all at once.

-Add a new variable called check. This check variable will be used as the number the smart program will be aiming for.

-Add a new variable called try. This variable will print out the amount of tries the autonomous program did to get to the correct answer in the range from 1 to 99.

Please see output examples given below.

import random

x = random.randint(1, 99)

guess = int(raw_input("Enter an integer from 1 to 99: "))

while x != "guess":

print

if guess

print "guess is low"

guess = int(raw_input("Enter an integer from 1 to 99: "))

elif guess > x:

print "guess is high"

guess = int(raw_input("Enter an integer from 1 to 99: "))

else:

print "AWESOME!"

break

print

Example 1:

Smart Guessing Game Programming Language: Python 3 For this program, you will

Example 2:

need to use the given code and make add the following requirements:

Welcome to the Smart Computer Guessing Game Check Number: 31 Try(s): 4 Number guessed: 31

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!