Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a python program to play the guess the number game. The computer will pick a magic number between 1 and 100 and the user

Write a python program to play the guess the number game. The computer will pick a magic number between 1 and 100 and the user will try to guess the number in as few guesses as possible. The program will keep asking for a guess until the magic number is entered by the user. The program will also give hints to the user (hot or cold) based on whether the new guess is closer or further to the magic number compared to the previous guess. For the first guess, it will be assumed the previous guess is 50. The program will output the number of guesses.

Below is a sample run of how the program should proceed:

I am thinking of a number between 1 and 100. Can you guess what the number is? Enter your guess: 40 Cold! Enter your guess: 75 Hot! Enter your guess: 87 Hot! Enter your guess: 82 You win! You solved it in 4 guesses.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Making Databases Work The Pragmatic Wisdom Of Michael Stonebraker

Authors: Michael L. Brodie

1st Edition

1947487167, 978-1947487161

More Books

Students also viewed these Databases questions

Question

Explain the importance of Human Resource Management

Answered: 1 week ago

Question

Discuss the scope of Human Resource Management

Answered: 1 week ago

Question

Discuss the different types of leadership

Answered: 1 week ago

Question

Write a note on Organisation manuals

Answered: 1 week ago

Question

d. Who are important leaders and heroes of the group?

Answered: 1 week ago