Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question

PYTHON!!!!

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.

 

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 =, <, or >: <

0 4

Your number is 2

Enter =, <, or >: > 3 4

Your number is 3

Enter =, <, or >: =

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 =, <, or >: <

0 24

Your number is 12

Enter =, <, or >: <

0 11

Your number is 5

Enter =, <, or >: <

0 4

Your number is 2

Enter =, <, or >: <

0 1

Your number is 0

Enter =, <, or >: >

1 1

Your number is 1

Enter =, <, or >: >

I'm out of guesses, and you cheated!
 
 
Correct Solutions
 
Input:
0
10
<
>
=
 
Output: 
Enter the smaller number: 0
Enter the larger number: 10
Enter your guess: <
 
Results:
number is 3
Hooray, I've got it in 3 tries
 
 
Correct Solutions:
 
Input: 
0
25
<
>
>
>
=
 
 
Output:
Enter the smaller number: 0
Enter the larger number: 25
Enter your guess: <
 
Results: 
number is 11
Hooray, I've got it in 5 tries
 
 
Input:
0
50
<
<
<
<
>
>
 
 
Output:
Enter the smaller number: 0
Enter the larger number: 50
Enter your guess: <
<
<
<
>
>
 
Results:
I'm out of guesses, and you cheated
 
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education