How can I limit the user input to only certain integers (ie: Only between 1-100, which also includes 1 and 100) in Python
<p>I am trying to make a Guess the number game for my Computing homework but I dont't know how to limit the user to only input certain integers (ie: 1-100, also including 1 and 100) This is my code so far:</p>

<pre><code>import random

BOUNDS = (1, 100)
TRIES_ALLOWED = 6

the_number = random.randint(*BOUNDS)

print("\tWelcome to 'Guess My Number'!\n")
print("I'm thinking of a number between %d and %d." % BOUNDS)
print("Try to guess it in as few attempts as possible.")
print("You only have 6 attempts to guess the number.\n")

for tries in range(TRIES_ALLOWED):
guess = int(input("Take a guess: "))

if guess &gt; 100:
    print ('That is an error please enter a number between 1 and 100')

if guess &lt; 1:
    print ('That is an error please enter a number between 1 and 100')

if guess &gt; the_number:
    print("The number is lower")
elif guess &lt; the_number:
    print("The number is higher")
else:
    print("You guessed it! The number was %d" % (the_number))
    print("And it only took you %d tries!\n\n" % (tries + 1))
    break
else:
print("You failed to guess in time!\n\n")
</code></pre>

<p>It would be greatly appreciated if you could help me out</p>