【Python爬虫】-第二周作业

people = 20
cats = 30
dogs = 15
print(dogs)
if people < cats:

如果20<15 执行下面代码

print( "Too many cats! The world is doomed!")

if people > cats:

如果20>15 执行这句代码

print( "Not many cats! The world is saved!")

if people < dogs:

如果20<15 执行这句代码

print( "The world is drooled on!")

if people > dogs:

如果20>15 执行这句代码

print(   "The world is dry!")

让dogs由原来的值加5

dogs+=5

dogs=dogs+5=15+5=20

print(dogs)
if people > dogs:

如果20>20 执行这句代码

 print("People are greater than or equal to dogs.")

elif people < dogs:

如果20<20执行这句代码

print ("People are less than or equal to dogs.")

else:

如果20=20执行这句代码

print  ("People are dogs.")

执行结果

图示.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容