首页 > 其他 > 详细

判断随机数的函数:

时间:2020-02-28 21:34:03      阅读:74      评论:0      收藏:0      [点我收藏+]

1,流程图:

技术分享图片

 

 

技术分享图片
import random
question=input("would you want to play a number game?:")
if question=="yes":
    value=random.randint(0,100)
    ret1=0
    ret2=100
    while True:
        count=1
        question_two=(int(input("Try to guess the number: ")))
        if question_two>value:
                 print("请输入%s到%s之间的数"%(ret1,question_two))
                 ret2=question_two
                 continue
        elif question_two<value:
                 print("请输入%s到%s之间的数"%(question_two,ret2))
                 ret1=question_two
                 continue
        else:
             print("That\‘s it")
             question_three=input("would you like to play again?:")
             if question_three==yes:
                continue
             else:
                break
else:
   question=="no"
结果为
View Code

 

判断随机数的函数:

原文:https://www.cnblogs.com/ab461087603/p/12378703.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!