# 猜年龄小游戏,有三点需求
#
# 1.允许用户最多尝试3次
#
# 2.每尝试3次后,如果还没猜对,就问用户是否还想继续玩,如果回答Y或y,就继续让其猜3次, 以此。往复,如果回答N或n,就退出程序
#
# 3.如何猜对了,就直接退出
print("Welcome to this game that it designed to guess the age of author. Please input a age number. ")
def process_2():
count = 3
age = 23
def process_1(count, age):
if count > 0:
guessed_age = int(input())
if guessed_age == age:
print("You win!!!")
exit(0)
else:
print("You are wrong. Try again!")
count = count - 1
process_1(count, age)
else:
print("This round is over.If you want to play another round, please reply 'Y'or'y'. \
On the contrary please reply 'N'or'n'.")
def again():
reply = input()
if reply == 'N' or reply == 'n':
print("Thank you for your playing!")
elif reply == 'Y' or reply == 'y':
print("Game continue.Please try other number.")
process_2()
else:
print("Your letter is illegal. Please input valid letter again.")
again()
again()
process_1(count, age)
process_2()