subject

Modify the guessing-game program so that the user thinks of a number that the computer must guess. The computer must make no more than the minimum number of guesses, and it must prevent the user from cheating by entering misleading hints.
Use I'm out of guesses, and you cheated and Hooray, I've got it in X tries as your final output.
(Hint: Use the math. log function to compute the minimum number of guesses needed after the lower and upper bounds are entered.)

Below are two test runs of the program:

Enter the smaller number: 0
Enter the larger number: 10

0 10
Your number is 5
Enter =, : : >
3 4
Your number is 3
Enter =, : =
Hooray, I've got it in 3 tries!
Enter the smaller number: 0
Enter the larger number: 50
0 50
Your number is 25
Enter =, : : : : : >
1 1
Your number is 1
Enter =, : >
I'm out of guesses, and you cheated!

The results you should get:

number is 3Hooray, I've got it in 3 tries

number is 11Hooray, I've got it in 5 tries

I'm out of guesses, and you cheated

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 05:10
Suppose we have a byte addressable computer that has a 32-byte cache with 8 bytes per block. the memory address is 8 bits long. the system accesses memory addresses (in hex) in this exact order: 6e, b9, 17, e0, 4e, 4f, 50, 91, a8, ab, ad, 93, and 94. (a) assuming the cache is direct mapped, what memory addresses will be in cache block 2 after the last address has been accessed? (b) assuming the cache is direct mapped, what is the hit ratio for the entire memory reference sequence given, assuming the cache is initially empty? (c) assuming the cache is 2-way set associative with a lru replacement policy, what is the hit ratio?
Answers: 3
question
Computers and Technology, 22.06.2019 10:00
Create a word problem that involves calculating the volume and surface area of a three-dimensional object. cube: surface area 6 s2 , volume s3
Answers: 3
question
Computers and Technology, 23.06.2019 05:00
Which best explains why a digital leader would join a society specializing in technology
Answers: 1
question
Computers and Technology, 23.06.2019 09:30
You have been supporting csm tech publishing's windows server 2016 server network for over a year. the office has two windows server 2016 servers running active directory and a number of other roles. management has informed you that a small sales office is opening in the same building three floors up. the sales manager wants to install a sales application on a server located in the sales office. this server will have limited physical security because there's no special room dedicated for it, which means it will be accessible to non-it personnel and visitors. you're considering installing windows server 2016 server core on the new server because accessing its console regularly probably won't be necessary, and this server will be managed from one of the other csm tech publishing servers. what are the benefits and drawbacks of using server core for this branch office? what are some things you should do to set up this server management environment?
Answers: 1
You know the right answer?
Modify the guessing-game program so that the user thinks of a number that the computer must guess....
Questions
question
Mathematics, 10.09.2021 01:00
question
Geography, 10.09.2021 01:10
question
Mathematics, 10.09.2021 01:10
question
Engineering, 10.09.2021 01:10
question
Mathematics, 10.09.2021 01:10
question
Spanish, 10.09.2021 01:10