You work for a professional psychic. Unfortunately, this particular psychic has trouble reading minds, which is a service she would like to offer her clients. The psychic hires you to write a script that will correctly guess an unknown integer that has been picked by her client. The script should accept a lower and upper bound which is provided by the client and should use the minimum number of guesses to discover the unknown integer. The unknown integer will always lie within the lower and upper bounds specified by the client.

The script should not have access to the unknown integer when the code initially runs. The client can give input in only two ways: specifying the lower and upper bounds; and by answering yes/no questions. Write the code to perform this task.

Respuesta :

We have that the Print Program to perform the functions 'specifying the lower and upper bounds; and by answering yes/no questions" given as

print('Number is: ' + str(mid))

break

ans = input('Is ' + str(mid) + ' greater than your number? ')

if ans == 'yes':

high = mid

else:

low = mid

Program Algorithm

Generally the Programs Algorithm  is given as

low = int(input('Enter minimum value of range: '))

high = int(input('Enter maximum value of range: '))\

while high > low: #Loop starts

mid = (int)((high + low) // 2)

ans = input('Is ' + str(mid) + ' equal to your number? ')

if ans == 'yes':

print('Number is: ' + str(mid))

break

ans = input('Is ' + str(mid) + ' greater than your number? ')

if ans == 'yes':

high = mid

else:

low = mid

For more information on Programs visit

https://brainly.com/question/13940523