'''
Created on Jun 17, 2013

@author: Jared

Guessing Game: An example illustrating loops where the user has to guess
                a secret number in between 1 and 100.
Python translation of Arup's code
'''

from random import randint

MAX = 100

def main():
        # Create the secret number.
        num = randint(1, MAX)
        guess = 0
        
        # Play until the user guesses the number.
        while (guess != num):
            # Get the user's next guess.
            guess = int(input("Enter your guess.\n"))
            
            # Print out the appropriate message based on this guess.
            if (guess < num):
                print("Your guess is too low.")
            elif (guess > num):
                print("Your guess is too high.")
            else:
                print("Hooray! You got it, you win!")
                
# runs main module on startup
if __name__ == "__main__":
    main()
