Python三期爬虫作业

【Python爬虫】-第二周作业

2017-08-04  本文已影响11人  游离的栖息地

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
上一篇下一篇

猜你喜欢

热点阅读