Case Scenario: You are going to build a "reverse" guessing game in Python. You will think of a number, the computer will make a guess, and you will tell the computer if it was correct or to adjust its next guess higher or lower. The computer has 10 tries to guess your number. What Your Python Program Should Do: Your program will try to guess a number that the user is thinking of, between 1 and 20. Your program should accept input from the user as to whether its guess was too high or too low, and change its next guess accordingly. The computer has 10 tries to guess the number the user is thinking of. For each guess the computer makes: 1. Print a message telling the user what number the computer guessed. 2. Ask the user to enter "h" if the computer's guess was too high, “l” if the computer's guess was too low, or "c" if the computer's guess was correct. All letters are lowercase and without quotes. 3. If the computer's guess was correct, print a message telling the user how many guesses it took for the computer to guess the user's number correctly. Print a congratulations message and end your program. 4. If the computer's guess was too high, subtract from the guess a random number between 1 and 5. Use this new number as the next guess. Add some code to check if the new guess is below 0, and if it is, set the new guess equal to 1. 5. If the computer's guess was too low, add to the guess a random number between 1 and 5. Add some code to check if the new guess is above 20, and if it is, set the new guess equal to 20. 6. If the computer has reached the 10-guess limit, print a message saying that it was unable to guess the user's number in 10 tries. Important Things to Remember: - Tell the user each new guess and let the user continue providing input. The program must run until the user enters "c" (no quotes) or the computer reaches the 10-guess limit. Your program must include a for loop somewhere. No hardcoding allowed.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
icon
Concept explainers
Question
Case Scenario:
You are going to build a "reverse" guessing game in Python. You will think of a number, the
computer will make a guess, and you will tell the computer if it was correct or to adjust its next
guess higher or lower. The computer has 10 tries to guess your number.
What Your Python Program Should Do:
Your program will try to guess a number that the user is thinking of, between 1 and 20. Your
program should accept input from the user as to whether its guess was too high or too low, and
change its next guess accordingly. The computer has 10 tries to guess the number the user is
thinking of.
For each guess the computer makes:
1. Print a message telling the user what number the computer guessed.
2.
Ask the user to enter “h” if the computer's guess was too high, “1” if the computer's
guess was too low, or "c" if the computer's guess was correct. All letters are lowercase
and without quotes.
3. If the computer's guess was correct, print a message telling the user how many guesses it
took for the computer to guess the user's number correctly. Print a congratulations
message and end your program.
4. If the computer's guess was too high, subtract from the guess a random number between
1 and 5. Use this new number as the next guess. Add some code to check if the new guess
is below 0, and if it is, set the new guess equal to 1.
5. If the computer's guess was too low, add to the guess a random number between 1 and 5.
Add some code to check if the new guess is above 20, and if it is, set the new guess equal
to 20.
6. If the computer has reached the 10-guess limit, print a message saying that it was unable
to guess the user's number in 10 tries.
Important Things to Remember:
Tell the user each new guess and let the user continue providing input.
The program must run until the user enters "c" (no quotes) or the computer reaches the
10-guess limit.
Your program must include a for loop somewhere.
No hardcoding allowed.
Transcribed Image Text:Case Scenario: You are going to build a "reverse" guessing game in Python. You will think of a number, the computer will make a guess, and you will tell the computer if it was correct or to adjust its next guess higher or lower. The computer has 10 tries to guess your number. What Your Python Program Should Do: Your program will try to guess a number that the user is thinking of, between 1 and 20. Your program should accept input from the user as to whether its guess was too high or too low, and change its next guess accordingly. The computer has 10 tries to guess the number the user is thinking of. For each guess the computer makes: 1. Print a message telling the user what number the computer guessed. 2. Ask the user to enter “h” if the computer's guess was too high, “1” if the computer's guess was too low, or "c" if the computer's guess was correct. All letters are lowercase and without quotes. 3. If the computer's guess was correct, print a message telling the user how many guesses it took for the computer to guess the user's number correctly. Print a congratulations message and end your program. 4. If the computer's guess was too high, subtract from the guess a random number between 1 and 5. Use this new number as the next guess. Add some code to check if the new guess is below 0, and if it is, set the new guess equal to 1. 5. If the computer's guess was too low, add to the guess a random number between 1 and 5. Add some code to check if the new guess is above 20, and if it is, set the new guess equal to 20. 6. If the computer has reached the 10-guess limit, print a message saying that it was unable to guess the user's number in 10 tries. Important Things to Remember: Tell the user each new guess and let the user continue providing input. The program must run until the user enters "c" (no quotes) or the computer reaches the 10-guess limit. Your program must include a for loop somewhere. No hardcoding allowed.
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Operators
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education