您的位置:首页 > 编程语言 > Python开发

第29个python程序:if语句

2016-09-28 15:09 344 查看
[root@mysql1 pshell]# cat ex29.py    

#!/usr/bin/env Python

#-*-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 grater than or equal to dogs."

if people<=dogs:

  print "people are less than or equal to dogs."

if people==dogs:

  print "people are logs."

[root@mysql1 pshell]# 

[root@mysql1 pshell]# 

[root@mysql1 pshell]# 

[root@mysql1 pshell]# 

[root@mysql1 pshell]# python ex29.py 

too many cats! the world is doomed!

the world is dry!

people are grater than or equal to dogs.

people are less than or equal to dogs.

people are logs.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  python