This is a simple guessing game where you are prompted for a minimum and maximum value, then you must guess the number the computer chooses! This is the first program I have written so any and all suggestions are welcome.def guessinggame():    print Welcome to the Guessing Game!.    while True:        try:            numrange1 = int(raw_input(What is the minimum number you want?: ))            break        except ValueError:            print This must be an integer!    while True:        try:            numrange2 = int(raw_input(What is the maximum number you want?: ))            break        except ValueError:            print This must be an integer!    rnumber = random.randint(numrange1, numrange2)    i = 0    while True:        x = int(raw_input(What is your guess?: ))        if rnumber > x:            print Low!            i = i + 1        elif rnumber < x:            print High!            i = i + 1        elif rnumber == x:            print Correct!            i = i + 1            print i            break    again = raw_input(Would you like to play again? (y/n): )    if again == 'y':        guessinggame()guessinggame()
Number-guessing game with maximum and minimum values
python;number guessing game
You are inappropriately using the guessinggame() function as if it were a goto label.  After playing the game repeatedly, you will end up with a deep stack trace (which you can see by hitting ControlC), which is a bad sign.  A proper design would be:def guessing_game():    # Code to play one gameplay = Truewhile play:    guessing_game()    play = ('y' == raw_input('Would you like to play again? (y/n): '))Curiously, you check that the bounds are integers, but you don't bother to validate the guesses.  You also don't check that the minimum is less than the maximum.All three prompts would benefit from a shared integer-prompting routine:def prompt_int(prompt, err_msg='This must be an integer!'):    while True:        try:            return int(raw_input(prompt))        except ValueError:            print err_msgGetting that clutter out of the way makes your main function more readable:def guessing_game():    print Welcome to the Guessing Game!.    rnumber = None    while rnumber is None:        lower = prompt_int('What is the minimum number you want?: ')        upper = prompt_int('What is the maximum number you want?: ')        if lower < upper:            rnumber = random.randint(lower, upper)        else:            print The minimum must be less than the maximum!    tries = 0    while True:        guess = prompt_int(What is your guess?: )        tries += 1        if guess < rnumber:            print Low!        elif guess > rnumber:            print High!        elif guess == rnumber:            print Correct!            print tries            breakI've renamed numrange1 to lower, numrange2 to upper, i to tries, and x to guess.  Incrementing the loop counter is common to all three branches and can be factored out.