Python自动化3.0-------学习之路-------while循环(猜字游戏)!

猜数字程序:

#Author:Mego

age_mego =30

count =0

while count <3:

        guess_age =int(input("请输入想猜的数字:"))

        if guess_age==age_mego:

            print("输入的数字正确!")

            break

        elif guess_age > age_mego:

           print("输入的数字大了")

        else:

          print("输入的数字太小!")

       count +=1

#输入三不正确,重置计数器

       if count ==3:

          countine_confirm=input(你是否还想继续输入:")

           if  countine_confirm !='n':

                count =0

posted @ 2017-07-22 14:34  Mego_Mateng  阅读(277)  评论(0编辑  收藏  举报