# coding=utf-8
people = 20
cats = 30
dogs = 15
if people < cats:
print("Too many cats! The world is doomed!")
if people > cats:
print("Not many cats! The world is saved!")
if people < dogs:
print("The world is drooled on!")
if people >dogs:
print("The world is dry!")
dogs += 5
if people >= dogs:
print("People are greater than or equal to dogs.")
if people <= dogs:
print("People are less than or equal to dogs.")
if people == dogs:
print("People are dogs.")
"""
1.+= 是什么意思?
x += 1 和 x = x + 1 一样,只不过可以少打几个字母。你可以把它叫做加值符。一样
的,你后面还会学到 -= 以及很多别的表达式。
"""
笨方法学习Python-习题29: 如果(if)
最新推荐文章于 2019-06-21 09:58:46 发布