Question: PYTHON!!!!! 1. Task Write a file named higher_lower.py that plays a simple guessing game with you. The computer will pick a number between 1 and
PYTHON!!!!!
1. Task Write a file named higher_lower.py that plays a simple guessing game with you. The computer will pick a number between 1 and 100, then give you a given number of guesses. If you guess right, it will say "You win!". If you guess higher or lower than correct, it will say "The number is higher than that." (or lower). If after the given number of guesses they still don't know the number, print "You lose; the number was x." where x was the number you were to guess. Before the game begins, . Ask what number to pick. If they say "-1", pick randomly; otherwise, use their number even if it is outside the 1-100 range. 2. Ask how many guesses they should have. You may assume they respond with a positive integer. 2. Example Invocations An example run of the program might look like What should the answer be? 19 How many guesses? 9 Guess a number: 9 The number is higher than that Guess a number: 40 The number is lower than that. Guess a number: 19 You win
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
