Python3.5-20190504-廖老师的2-if elif else continue break

条件判断:

if 条件1:

  代码块

elif 条件2:

  代码块

else 条件3:

  代码块

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

if  brith > 2000:

  print("00后")

扫描二维码关注公众号,回复: 6118154 查看本文章

elif 1990<brith <2000:

  print("90后")

else brith<90:

  print("80后")

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

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

循环语句:

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

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

猜你喜欢

转载自www.cnblogs.com/tarzen213/p/10810316.html