>>> def gtn_3x():
import random
n=input("Enter name: ")
print("Welcome to Guess the Number,",n+"!")
print("I will think of a number between 1 to 10.")
x=random.randint(1, 10)
print("You will be given 3 chances before GAME OVER.")
c=3
print("Good luck!")
while True:
try:
y=int(input("Enter number: "))
c=c-1
if y==x:
print("Congratulations!")
break
elif y<1 or y>10:
c=c+1
if c>0:
print("Error, out of range. You still have", c, "chance(s)
left.")
continue
else:
print("GAME OVER")
break
elif y==x+1 or y==x-1:
if c>0:
print("Close! You have", c, "chance(s) left.")
continue
else:
print("GAME OVER")
break
elif y>x:
if c>0:
print("Too big! You have", c, "chance(s) left.")
continue
else:
print("GAME OVER")
break
elif y<x:
if c>0:
print("Too small! You have", c, "chance(s) left.")
continue
else:
print("GAME OVER")
break
except:
print("Error, please check input. You still have", c, "chance(s) left.")