Programming Assignment #1: Guessing Game (Due before class on Friday, Jan. 31)

Write a program to implement the following high-low number guessing game.

  • Use “from random import randint” and the “randint(1,100)” function to generate a random number between 1 and 100. (Hint: For testing your game it’s good to print the answer that the player should be guessing. Of course when it’s all working you will want to comment out that print statement.)
  • Let the user try to guess the number and say whether the guess is too high, too low, or correct.
  • Let the user try to guess over and over until they get the right answer (or run out of guesses).
  • Keep score and report how many tries the user needed.
  • Implement a way for the player to fail at the game. (Perhaps only 3-4 guesses allowed?)
  • For a B: Let the player play multiple times and keep track of the high score of all tries.
  • For an A: Use a file to store the top three highest scores and player names, so that they get remembered even when the program is stopped and restarted.

Source link

Leave a Reply

Your email address will not be published. Required fields are marked *