Problem 2 Write a program that guesses a mystery number! The program works as follows: you (the user) thinks of an integer between 0 to 100. The program then makes guesses, and you give it input if its guess is too high or too low. Shown below is an example of the expected console output when running the program. In [1]: runfile('C:/Users/Tim/Expt4Prob2.py', wdir='C:/Users/Tim') Please think of a number between 0 and 100! Is your number 50? (H/L/Yes): H Is your number 25? (H/L/Yes): H Is your number 12? (H/L/Yes): L Is your number 18? (H/L/Yes): H Is your number 15? (H/L/Yes): H Is your number 13? (H/L/Yes): L Is your number 14? (H/L/Yes): Yes Game over! Your mystery number is 14

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter4: Selection Structures
Section4.3: Nested If Statements
Problem 7E
icon
Related questions
icon
Concept explainers
Question

PYTHON PROGRAMMING

Problem 2
Write a program that guesses a mystery number!
The program works as follows: you (the user) thinks of an integer between 0 to 100.
The program then makes guesses, and you give it input if its guess is too high or too
low. Shown below is an example of the expected console output when running the
program.
In [1]: runfile('C:/Users/Tim/Expt4Prob2.py', wdir='C:/Users/Tim')
Please think of a number between 0 and 100!
Is your number 50? (H/L/Yes): H
Is your number 25? (H/L/Yes): H
Is your number 12? (H/L/Yes): L
Is your number 18? (H/L/Yes): H
Is your number 15? (H/L/Yes): H
Is your number 13? (H/L/Yes): L
Is your number 14? (H/L/Yes): Yes
Game over! Your mystery number is 14
Transcribed Image Text:Problem 2 Write a program that guesses a mystery number! The program works as follows: you (the user) thinks of an integer between 0 to 100. The program then makes guesses, and you give it input if its guess is too high or too low. Shown below is an example of the expected console output when running the program. In [1]: runfile('C:/Users/Tim/Expt4Prob2.py', wdir='C:/Users/Tim') Please think of a number between 0 and 100! Is your number 50? (H/L/Yes): H Is your number 25? (H/L/Yes): H Is your number 12? (H/L/Yes): L Is your number 18? (H/L/Yes): H Is your number 15? (H/L/Yes): H Is your number 13? (H/L/Yes): L Is your number 14? (H/L/Yes): Yes Game over! Your mystery number is 14
Expert Solution
steps

Step by step

Solved in 4 steps with 2 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
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr