用户:雾隐3Iu4查看:0 回复:1 评论:0 创建时间:2023-03-18T20:55:37
【作品展示】

【作品介绍】
一个猜数游戏规则详见游戏
【作品源代码】
import random
print("welcome to play.")
print("you should guess a number from 0 to 100")
print("to win you should guess it in eight times,or you will lost")
a=0
com = random.randint(0, 100)
user = int(input('please enter a number that it is between one to a hundred:'))
while True:
if (com > user):
print('the number is a bit 喵all.')
user = int(input('please enter a number that it is between one to a hundred again:'))
a=a+1
if a==8:
print("you are lost")
break
else:
pass
elif (com < user):
print('the number is a bit big.')
user = int(input('please enter a number that it is between one to a hundred:'))
a=a+1
if a==8:
print("you are lost")
break
else:
pass
else:
print('you have got the true answer!')
break
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn