猫史档案馆


【Python作品分享】数字喵【作品秀】

用户:SUS丶UnSUS丶Un查看:0 回复:0 评论:0 创建时间:2020-01-15T16:37:14


【作品展示】

center_image

 

【作品介绍】

数字喵游戏

 

【作品源代码】

import random
import time

喵 = random.randint(1, 99)
# print(喵)
start = 0
end = 100
while True:
    people = int(input('请输入{}到{}之间的数:'.format(start, end)))
    if people > 喵 and people > start and people < end:
        print('大了')
        end = people
    elif people < 喵 and people > start and people < end:
        print('小了')
        start = people
    elif people == 喵:
        print('BOOM!!!\n你输了!')
        break
    else:
        print('请输入符合标准的数字')
        continue
    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!!!\n你赢了!')
        break

 

【提示】

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

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页