闲话不说贴代码(就不写什么HelloWorld了,太low没脸写)
importrandom
secret = random.randint(1,100)# create a random number
print(secret)
time =9# the time of guess
guess =0# the number input
minNum =0
maxNum =100
print('===============>猜数字游戏开始啦!')
whileguess != secretandtime >=0:
guess =int(input("*Please input number between 0-100:"))
# print("Your number is :",guess)
ifguess == secret:
print("Great!you are right")
else:
ifguess < secret:
minNum = guess
print("Your number is less than answer")
print("Now,the range of number is:",minNum,"-",maxNum)
else:
maxNum = guess
print("Your number is max than answer")
print("Now,the range of number is:",minNum,"-",maxNum)
print("You are wrong,you have ",time,"times")
time -=1
print('Game over! the answer is :',secret)