码迷,mamicode.com
首页 > 其他好文 > 详细

笨办法29IF语句

时间:2017-12-15 00:50:48      阅读:297      评论:0      收藏:0      [点我收藏+]

标签:nbsp   oom   图片   not   dog   http   people   post   span   

 1 people = 20
 2 cats = 30 
 3 dogs = 15
 4 
 5 if people < cats:
 6     print "Too many cats! The world is doomed!"
 7     
 8 if people > cats:
 9     print "Not many cats! The world is saved!"
10     
11 if people < dogs:
12     print "The world is drooled on!"
13     
14 if people > dogs:
15     print "The world is dry!"
16     
17 dogs += 5
18 
19 if people >= dogs:
20     print "People are greater than or equal to dogs."
21     
22 if people <=dogs:
23     print "People are less than or equal to dogs."
24     
25 if people == dogs:
26     print "people are dogs."

技术分享图片

 

dogs += 5 即 dogs = dogs + 5

 

此时dogs=20,同时满足三个条件,输出三句

笨办法29IF语句

标签:nbsp   oom   图片   not   dog   http   people   post   span   

原文地址:http://www.cnblogs.com/p36606jp/p/8040565.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!