Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part 2: Guess the Number Game Note: This program should NOT be written using a while loop. You should be able to write this using

image text in transcribed

Part 2: Guess the Number Game Note: This program should NOT be written using a "while" loop. You should be able to write this using "if", "elif" and "else" statements only. Also, you are not allowed to use the "sys.exit0" function to cause your program to prematurely quit! Write a program that lets the user guess an integer between 1 and 10. The integer should be randomly selected by your program when it starts up. Your player is allowed to guess three times- if they guess correctly, they win and the program ends. If they guess incorrectly they should be told if the number they guessed was too high or too low and then be asked to guess another time. At the end of the program you shoud display the secret number as well as how many attempts it took to guess that number. Here are a few sample runnings of your program Run #1 I'm thinking of a number between 1 and 10! What's your guess? 5 You got it! The secret number was 5. It took you 1 try to guess the number. Run #2 I'm thinking of a number between 1 and 10! What's your guess? 5 Too low, try again. What's your guess? 8 Too high try again. What's your guess? 7 You got it! The secret number was 7 It took you 3 tries to guess the number. Run #3 I'm thinking of a number between 1 and 10! What's your guess? 5 Too high, try again. What's your guess? 1 Too low, try again. What's your guess? 3 The secret number was 4 You didn't guess the number

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

Spatial Databases A Tour

Authors: Shashi Shekhar, Sanjay Chawla

1st Edition

0130174807, 978-0130174802

More Books

Students also viewed these Databases questions

Question

Enhance the basic quality of your voice.

Answered: 1 week ago

Question

Describe the features of and process used by a writing team.

Answered: 1 week ago