猫史档案馆


【Python作品分享】猜数字(1-100)【作品秀】

用户:NyanCat_233NyanCat_233查看:0 回复:0 评论:0 创建时间:2020-01-22T12:41:29


【作品展示】

center_image

 

【作品介绍】

我用海龟编辑器编的第一个作品,希望大家喜欢。

 

【作品源代码】

import random


score = 1
tallscore = score
win = 0
number = 4
while (win == 0):
    say = int(input('请输入一个1-100之间的数'))
    if (number > say):
        print('太小啦~')
        score += 1
    elif (number < say):
        print('太大啦~')
        score += 1
    else:
        print((('猜对啦~你一共猜了' + str(score)) + '次'))
        win += 1
        if (score < tallscore):
            tallscore = score
        print((('最高得分是' + str(tallscore)) + '次'))

 

【提示】

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

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页