How can I make sure users are turning in correct input, for Guess game in python 3.5.1?
Question: This is my code:

    
    
    from random import randint
    print("What is your name?")
    name=input()
    tries=0
    number= randint(1,100)
    print("Hello, %s guess a number from 0 to 100" % name)
    while tries < 8:
        print("Take a Guess")
        guess=input()
        guess=int(guess)
        if guess < number:
            print("Too Low")
            tries += 1
        if guess > number:
            print("Too High")
            tries += 1
        if guess == number:
            break
    
    if guess == number:
       print("You got it, in %s tries" % tries)
    
    if guess != number:
        print("Sorry try again!")
    

But it gives an error:

    
    
    Traceback (most recent call last):
      File "/Users/Zuazua/PycharmProjects/untitled/GuessMyNumber2.py", line 10, in <module>
        guess=int(guess)
    ValueError: invalid literal for int() with base 10: '23!'
    


Answer: Change the line `guess=int(guess)` into this:

    
    
    guess=int(re.search(r'\d+', guess).group())
    

