猫史档案馆


【Python作品分享】数字喵【教程贴】

用户:2023再见了机房保重2023再见了机房保重查看:0 回复:0 评论:0 创建时间:2023-03-26T10:50:40


【作品展示】

center_image

 

【作品介绍】

6666

 

【作品源代码】

import random
import time
import random


喵 = random.randint(1, 99)
start = 0
end = 99

for i in range(10):
    people = int(input('请输入{}到{}之间的数:'.format(start, end)))
    if (people > 喵):
        print('大了')
        end = people
    elif (people < 喵):
        print('小了')
        start = people
    else:
        print('BOOM!!!')
        break

print('等待电脑了输入{}到{}之间的数:'.format(start, end))

time.sleep(1)

com = random.randint((start + 1), (end - 1))

print('电脑输入:{}'.format(com))
if (com > 喵):
    print('大了')
    end = com
elif (com < 喵):
    print('小了')
    start = com
else:
    print('BOOM!!!')

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页