# Opposite Number Game problem

I was trying to except string and numbers > 10, but got an error:

```import random

def game():
try:
secret_num = int(input("Please enter a number from 1 to 10: "))
except ValueError:
print("{} is now a number!".format(secret_num))
except secret_num > 11:
print("{} greater than 10!".format(secret_num))

guesses = []
while len(guesses) < 3:
computer_num = random.randint(1, 10)
if secret_num == computer_num:
print("Well done! The number was {}".format(secret_num))
break
else:
print(computer_num)

game()
```

Please say, how to except strings and numbers > 10

What's the error?

Traceback (most recent call last):
File "opposite_number_game.py", line 8, in game
secret_num = int(input("Please enter a number from 1 to 10: "))
ValueError: invalid literal for int() with base 10: 'dfivdu'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "opposite_number_game.py", line 24, in <module>
game()
File "opposite_number_game.py", line 10, in game
print("{} is now a number!".format(secret_num))
UnboundLocalError: local variable 'secret_num' referenced before assignment
treehouse:~/workspace\$ Opposite Number game for reference (Try refactoring it for best practices) :

```import random
import time

guesslimit = Guess_limit
while guesslimit > 0:
time.sleep(3)
guess = random.randint(1,10)

if guess == Secret_Num:
print("You got it! the number was {}".format(Secret_Num))

elif Secret_Num - guess > 3:
print("Your guess {} is Too low".format(guess))
guesslimit -= 1

elif Secret_Num - guess < -3:
print ("Your guess {} is to high!".format(guess))
guesslimit -= 1

else:
print("Bummer! {} was close".format(guess))
guesslimit -= 1
if guesslimit == 1:
print("last chance Mr.Computer!\n")
time.sleep(1)
else:
print("\nThe secret number was : {}. Better Luck Next Time!".format(Secret_Num))

repeat_game = input("\n{} do you want to play again? press Y for Yes and N for No: ".format(username))
if repeat_game.lower() == "y":
main()
else:
print("bye!")

def main():

secret_Num = input("\n hey {}! Enter your secret number. Let the computer Guess :-)".format(Username))

try:
int(secret_Num)
except ValueError:
print("How do I add {} + {}?".format(secret_Num, secret_Num))
repeat_process = input("\nYou may want try again? if so, then press Y for Yes otherwise press N to end: ")
if repeat_process.lower() == "y":
main()
else:
print("bye!")
else:
if 1 <= int(secret_Num) <= 10:
else:
repeat_process = input("\n The number should be between 1-10. You may want try again? if so, then press Y for Yes otherwise press N to end: ")
if repeat_process.lower() == "y":
main()
else:
print("bye!") 