#猜数字游戏
import random #impor语句导入random模块
guessor=0;
print("#"*30) #输出30个”#“(”##############################“)用于装饰输出代码,同下
print("hello! \nwhat is you name?") #“\n”换行
print("#"*30)
Myname=input("please enter your name:")
print("*"*30)
print("hello {} \nlet's play game!".format(Myname))
print("*"*30)
number=random.randint(1,20) #调用random函数中的randit函数(用于生成指定范围的随机数)
print("well~"+Myname+",please guess the number between 1 and 2.\n")
print("You have six guesses.\n")
while guessor<=6: #while循环(循环到满足条件为止)
print("tack a guess")
guess=input("please enter your number:")
print("^"*30)
guess=int(guess)
guessor=guessor+1
if guess==number:
print("good! your are right")
break
if guess<number:
print("\ntoo low")
print("%"*30)
if guess>number:
print("\ntoo big")
print("%"*30)
print("\nYou've run out of guesses!")