Frenetic commented on a Page, Number guessing game  -  Jun 12, 2011

You could do

import random

print """\t\t\tWelcome to \"Guess the Number\"!
\nThink of a number between 1 and 100.
try to guess it in as few attempts as possible.\n"""

number = input ("Enter the number: ")

guess = random.randrange (100) + 1
tries = 1
useds = []

while (guess != number):
        if (guess > number):
                print "You chose", guess, "the number is Lower ..."
                useds.append(guess)
        else:
                print "You chose", guess, "the number is Higher ..."
                useds.append(guess)

        guess = random.randrange (100) + 1
        if guess in useds:
                while guess in useds:
                        guess = random.randrange(100) + 1
        else:
            tries += 1

print "You guessed it! The number was", number
print "And it only took you", tries, "tries!\n"

raw_input ("Press <ENTER> to exit.")
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.