分支和循环

了不起的分支和循环!! 

 

选择

  if

  elif

  elif

  else

python 可以有效的防止else悬挂问题

条件表达式

small = x if x < y else y

==

if x < y:

  small = x

else :   

  small = y

 

断言

assert

 

用于插入检查点特别有用 

 

while循环

while : 

   循环体

 

for循环

 

 

 

 

range()

 

 

 

continue, break;

 

posted @ 2020-05-24 15:32  lucky_light  阅读(205)  评论(0编辑  收藏  举报