- Conditional statements
python does not support the switch statement, a plurality of determination can only be achieved with elif, while at the same time to determine if a number of conditions, can be used or, expressed judge the success of both of these conditions have an established; use and, expressed only if two conditions are established under determine conditions before they succeed.
num=9 if num>=0 and num<=10: #判断是否在0~10之间 print 'hello' num=10 if num<0 or num>10: print 'hello' else print 'undefine' num=8 if (num>=0 and num<=5) or (num>=10 and num<=15): print 'hello' else: print 'undefine'
- cycle
python provides for and while loops, do not do ... while loop
break statement | Terminates the loop during the execution of statement block, and jump out of the entire cycle |
continue Statement | Terminates the current execution loop statement block, out of the cycle, the next cycle execution. |
The pass statement | pass an empty statement, in order to maintain the integrity of the program structure. |