Question: Following code stores 'random' integer into a variable. Asks user to guess the number. After guessed, program prompts if user wants to continue. I need

Following code stores 'random' integer into a variable. Asks user to guess the number. After guessed, program prompts if user wants to continue. I need help adding to this code to do the following: * Inform user that they have already chosen a specific integer (ex. if user already chose 22, inform user)

* If the user's guess is within +/-5, inform user

Thank you!!

Following code stores 'random' integer into a variable. Asks user to guess

5 6 import random play_game = True 8 9 10 11 while(play_game): answer = random.randint(1, 100) try_number = input('Enter a number between 1 and 100: ) try_number = int(try_number) counter = 1 12 13 14 15 16 17 18 19 20 while try_number != answer: if try_number > answer: print ('Your number is too large.') if try_number

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!