Python Classwork #7 (NumberGuessingGame) 07) Write a "number guessing" game where the computer randomly generates a positive integer, and then the player is allowed to try to guess the number. After each guess, the computer should tell the player whether the guess was too high, too low, or just right (the correct number). At the start of the program, the player should be prompted to choose the lower and upper boundaries (the range from which the randomly-generated number will be chosen), with a maximum upper boundary of one million. The player should also be asked how many guesses are allowed (up to 20) before the computer reveals the chosen number (if not correctly guessed by the player). All player input should be positive integers, and the upper boundary must be larger than the lower boundary. Be sure to ask for the lower boundary first, then for the upper boundary, and then for the number of allowed guesses. Every time you ask the player to enter a guess, you should also tell the player how many allowed guesses remain. After each game is over, your program should give the player an opportunity to play another round using the same player-chosen values, but with a new computer- generated random number. Your program does not need to error trap for illegally-formatted player input (i.e., non-integers) or missing data (player presses ENTER without entering anything). However, your program does need to check for all out-of-bounds entries (see above) for all player-inputted values. If such a value is entered, your program should display an appropriate message and the player should be required to re-enter the value. If the player enters an out-of-range guess, make sure that guess does not cause the remaining number of allowed guesses to decrease. In your program you should create a separate function to get the three initial values from the player, a separate function to choose the random number that the player needs to guess, and a separate function with the main game loop (where the player enters guesses and is given feedback). If you wish, all other code may go into the main area of the program. For this assignment, the 'randint' function is the only function that you may import and use. You may use global variables in your program. An example run of my program is shown below. Your output does not need to look exactly like mine, but your program should function in the same manner as my program in accordance with the directions above. Example Program Run ------------------- Welcome to Dave's Number Guessing Game! Please enter a lower boundary (integer greater than zero and less than one million): -3 The lower boundary that you entered is out of range! Please enter a lower boundary (integer greater than zero and less than one million): 1000000 The lower boundary that you entered is out of range! Please enter a lower boundary (integer greater than zero and less than one million): 0 The lower boundary that you entered is out of range! Please enter a lower boundary (integer greater than zero and less than one million): 10 Please enter an upper boundary (integer greater than low bound and <= one million): 10 The upper boundary that you entered is out of range! Please enter an upper boundary (integer greater than low bound and <= one million): 1000001 The upper boundary that you entered is out of range! Please enter an upper boundary (integer greater than low bound and <= one million): 20 Please enter the number of guesses that should be allowed (positive integer <= 20): 21 The guesses allowed that you entered is out of range! Please enter the number of guesses that should be allowed (positive integer <= 20): 0 The guesses allowed that you entered is out of range! Please enter the number of guesses that should be allowed (positive integer <= 20): 3 You have 3 guesses left. Please guess an integer from 10 to 20: 15 Your guess was too low. You have 2 guesses left. Please guess an integer from 10 to 20: 21 Your guess was out-of-bounds...try again. You have 2 guesses left. Please guess an integer from 10 to 20: 9 Your guess was out-of-bounds...try again. You have 2 guesses left. Please guess an integer from 10 to 20: 18 Good job...you guessed the chosen number! Would you like to play again with the same parameters (y/n)? y You have 3 guesses left. Please guess an integer from 10 to 20: 15 Your guess was too high. You have 2 guesses left. Please guess an integer from 10 to 20: 13 Your guess was too high. You have 1 guesses left. Please guess an integer from 10 to 20: 11 Your guess was too low. The chosen number was 12. Would you like to play again with the same parameters (y/n)? n ADVANCED OPTION FOR CLASSWORK #7 Error trap for ALL types of bad or missing player input.