Programming Homework Help

SNHU Python Number Guessing Game Program

 

Create a Python program for a number guessing game. Here are the requirements: Your program generates a random number between -100 and 100 and keeps asking the user to guess the number until the user guesses it correctly. Your random number generator should be implemented as a Python function that takes min and max as input parameters and returns a random number between those values, including the min and the max.

  1. Your program generates a random number between -100 and 100 and keeps asking the user to guess the number until they guess it correctly. Your random number generator should be implemented as a Python function that takes min and max as input parameters and returns a random number between those values, including the min and the max.
  2. If the user guesses a number that is lower or higher than the number to be guessed, then indicate that information to the user as a ‘low guess’ or a ‘high guess’ to get to the correct guess quicker.
  3. The program keeps track of the number of guesses taken by the user to get to the correct guess. This is the user’s score.
  4. Use a parameter for several allowed guesses (set it some value, say 7). Your program congratulates users if the user guesses the number correctly in some guesses less than the number of allowed guesses. The program doesn’t allow the user to continue beyond the number of allowed guesses and tells the user that the user did not guess correctly in allowed attempts. You can print the number of allowed guesses at the beginning of the game.
  5. Write out the user name and number of guesses taken to a game report file. Each attempt at the game will add a new line to the report file.