笨办法学Python3 习题29 if 语句

发布时间 2023-10-09 12:06:29作者: 萹豆
 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 equal to dogs.")
24 
25 if people == dogs:
26     print("People are dogs.")
PS C:\Users\Administrator\lpthw> python ex29.py
Too many cats! The world is doomed!
The world is dry!
People are greater than or equal to dogs.
People are less than equal to dogs.
People are dogs.