Python --- while statement

#while cycle when the condition is really, death cycle occurs
'''
How to avoid infinite loop: condition is a constant, a certain state of infinite loop occurs
Or to limit condition is a predetermined range

When the back while condition is false else statement is executed
'''
#while commonly used in the recursive algorithm
 
abc = 1
while abc <= 11:    
    abc += 1  
    print(abc)
else:
    print('It\'s over')
 
 

Guess you like

Origin www.cnblogs.com/carl007/p/12008982.html