Question: Python help please Python: Number Guessing Game Write a Python function called Guess . with one input and one output. The input is a value
Python: Number Guessing Game Write a Python function called "Guess ." with one input and one output. The input is a value to guess and the output is the number of guesses needed to find the value. Set up a doc string with the information you had to enter in MATLAB. The function will use a while statement to create a number guessing game: 1. If the function is called with no input use random.randint (a,b) to generate a random number between and including a-1 and b-1000. You l also need to have import random at the start 2. Ask a player to enter a number (integer) to be guessed 3. Use a while statement to give an indication if the number is higher or lower than the guess. 4. The process repeats until the number is guessed or the player types quit. If the player guesses the number, print out the number of guesses and end the function. Hint 1: Initialize guess counter variable (i.e. guess-0) before your while statement. Hint 2: You will need an if statement to deal with game quitters Hint 3: Your conditional while statement should compare the number generated to the current guess with three possible outcomes: high, low or you win. Hint 4: Use the command- break- to end the game when you win or when you quit
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
