Question: python You have been asked to write a program to keep children of all ages busy on a long trip. The program will allow the
python
You have been asked to write a program to keep children of all ages busy on a long trip. The program will allow the user to play the high/low game on a computer. The program will generate a random number from 1- 64 inclusive (I will show you show to do this.). The user will have 7 tries to guess it use a for loop. If the user's guess is outside the range specified, tell the user so and ask for another try, but don't count it as a try until the guess is within the range (This is a validation loop.). If the user's guess is too high or too low, the computer will tell them which and allow the user another guess until 7 guesses have been exceeded-use a for loop for this. If the user guesses the correct number, the program will say so and not ask for anymore guesses for that game. If the player loses, say so and display the random number. The program will then ask if the user wants to play again. If yes, a new random number will be generated. At the end of the last game, the computer will display how many games were won and what percent were won to 3 decimal places. See the sample below. You will need to use a for loop, two different types of while loops. if/clif/else, and the random function among other things. 2 3 4 S 6. I am thinking of a number in the range of 1-64 inclusive. You have 7 tries to guess it. 1 What is your guess? 33 Sorry your guess was too high. What is your guess? 16 Sorry your guess was too low. What is your guess? 24 Sorry your guess was too high. What is your guess? 20 B Sorry your guess was too low. What is your guess? 22 Sorry your guess was too high. 10 What is your guess? 21 11 12 Congrats, you are a winner in 6 tries!! 13 Enter yes to play again, anything else to quit. yes 7 9 14 15 16 17 18 19 20 21 22 23 24 25 I am thinking of a number in the range of 1-64 inclusive. You have 7 tries to guess it. What is your guess ? 95 Your guess was outside the range, try again. 25 Sorry your guess was too high. What is your guess? 15 Sorry your guess was too low. What is your guess? 33 Sorry your guess was too high. What is your guess? 45 Sorry your guess was too high. What is your guess? 10 Sorry your guess was too low. What is your guess? 63 Sorry your guess was too high. What is your guess? 56 Sorry your guess was too high. Sorry, you lose!! The number was 20 Enter yes to play again, anything else to quit. You won 1 games out of 2 for a winning percent of 50.000% 26 27 28 29 30 31 32 33 34
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
