Python Guessing game
Question: I am a beginner in python using 2.7.11 and i have made a guessing game. Here
is my code so far

    
    
    def game():  
        import random
        random_number = random.randint(1,100)
        tries = 0
        low = 0
        high = 100
        while tries < 8:
            if(tries == 0):
              guess = input("Guess a random number between {} and {}.".format(low, high))       
            tries += 1
            try:
              guess_num = int(guess)
            except:
              print("That's not a whole number!")
              break    
    
            if guess_num < low or guess_num > high:
              print("That number is not between {} and {}.".format(low, high))
              break    
    
            elif guess_num == random_number:
              print("Congratulations! You are correct!")
              print("It took you {} tries.".format(tries))
              playAagain = raw_input ("Excellent! You guessed the number! Would you like to play again (y or n)? ")
              if playAagain == "y" or "Y":  
                game()
    
            elif guess_num > random_number:
              print("Sorry that number is too high.")
              high = guess_num
              guess = input("Guess a number between {} and {} .".format(low, high))    
    
            elif guess_num < random_number:
              print("Sorry that number is too low.")
              low = guess_num
              guess = input("Guess a number between {} and {} .".format(low, high))    
    
            else:
              print("Sorry, but my number was {}".format(random_number))
              print("You are out of tries. Better luck next time.")
    game()
    

  1. How would i incorporate a system that makes it so Each time the user guesses the correct number it includes feedback giving the fewest number of guesses it took to correctly guess the number. Like a high score on how many guesses it took them and to change it only if it was beaten


Answer: you can create a static variable like this : `game.highscore = 10`

  * and you update it each time when the user wins the game (check if tries less than highscore)

