首页 > 代码库 > Python的Whiel循环和if流程判断

Python的Whiel循环和if流程判断

_age = 27

count = 0

while count < 3:

    age = input("what is you age? ")

    if age == _age:

        print "ni cai de {yourage} is sussccess" .format(yourage=age)

        break

    elif age < _age:

        print "ni cai de {yourage} nianlin xiao yu age" .format(yourage=age)

    else:

        print "ni cai de {yourage} nianlin da yu age" .format(yourage=age)

    count += 1

    #if count ==3:    

        #countine_confirm = raw_input("do you want to keep guessing..? ")    

        #if countine_confirm != ‘n‘:

            #count=0       

else:

    print ‘all count yong wan le‘


本文出自 “YHT的运维笔记” 博客,请务必保留此出处http://yht1990.blog.51cto.com/9014030/1940942

Python的Whiel循环和if流程判断