python之选择语句和pass语句和continue语句和break语句

if
在三目运算符中的格式:执行语句1  if   条件1  else  执行条件2

image

for
格式: for ... in ...经常搭配range来使用
image

备注:想要横向输出,我们经常添加这个语句:end=", "
image
案例:用for遍历字符
image

continue语句:
跳过当前循环,执行下一轮
image

break语句:
break语句会立刻退出
image

pass
他的作用就是用来占位的
image

posted @ 2026-05-13 11:12  刘sir金牌讲师  阅读(9)  评论(0)    收藏  举报