重拾python 二十九
来源:互联网 发布:手机网络连接异常101 编辑:程序博客网 时间:2024/04/28 07:51
这一节学习下if的用法,ex29.py:
#!/usr/bin/python# -*- coding: utf-8 -*-people = 20cats = 30dogs = 15if 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 += 5if 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."
运行得到结果:
Too many cats! The world is doomed!
The world is dry!
People are greater than or equal to dogs.
People are less than or equal to dogs.
People are dogs.
0 0
- 重拾python 二十九
- 重拾python 十九
- 重拾Python 二
- 重拾python 二十
- 重拾python 二十一
- 重拾python 二十二
- 重拾python 二十四
- 重拾python 二十五
- 重拾python 二十六
- 重拾python 二十七
- 重拾python 二十八
- python 学习笔记(二十九)
- Python的学习(二十九)---- linux下python调试
- Python进阶(二十九)-Python时间&日期&时间戳处理
- 二十九、在storm上运行python程序(修正)
- Python零基础入门二十九之Tkinter隐藏技能
- python入门(二十九):面向对象之多态
- 重拾java基础(十九):GUI简单使用总结
- Ubuntu 16.04下安装Android studio 中文乱码问题
- 关于 cookie
- 封装SQL 分页 缩放 上传类
- hdu 1061 快速幂取余模版裸题
- 龙凤
- 重拾python 二十九
- oracle数据库scn号查询
- Java开发中的23种设计模式详解
- 使用redis作为访问记录存储的构想
- pl/sql developer 执行输出时中文乱码问题
- Android之ContentProvider
- Linux集群批量管理工具parallel-ssh(PSSH)的安装与使用
- 获得建表或索引的方法
- zookeeper会话及普遍模型