条件判断:

if 条件1:

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

  代码块

elif 条件2:

  代码块

else 条件3:

  代码块

 

brith = input("请输入出身年月:")  

if  brith > 2000:

  print("00后")

elif 1990<brith <2000:

  print("90后")

else brith<90:

  print("80后")

input 用户从键盘输入的都是字符串(默认的),所以需要转成整数才能比较   int(brith)   

pycharm 就是这么的强大:它会提示你

Python3.5-20190504-廖老师的2-if elif else continue break 随笔 第1张

Python3.5-20190504-廖老师的2-if elif else continue break 随笔 第2张

 

循环语句:

 

Python3.5-20190504-廖老师的2-if elif else continue break 随笔 第3张

 

break 停止循环,直接执行下面的代码

Python3.5-20190504-廖老师的2-if elif else continue break 随笔 第4张

 

 continue跳过本次循环,继续下面的循环

Python3.5-20190504-廖老师的2-if elif else continue break 随笔 第5张

 

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄