重拾python 三十
来源:互联网 发布:人工智能读后感 编辑:程序博客网 时间:2024/04/29 09:52
接下来看看,if,else和elif,ex30.py:
#!/usr/bin/python# -*- coding: utf-8 -*-people = 30cars = 40trucks = 15if cars > people: print "We should take the cars."elif cars < people: print "We should not take the cars."else: print "We can't decide."if trucks > cars: print "That's too many trucks."elif trucks < cars: print "Maybe we could take the trucks."else: print "We still can't decide."if people > trucks: print "Alright, let's just take the trucks."else: print "Fine, let's stay home then."
运行后:
We should take the cars.
Maybe we could take the trucks.
Alright, let’s just take the trucks.
0 0
- 重拾python 三十
- 重拾Python 一
- 重拾Python 二
- 重拾Python 三
- 重拾Python 四
- 重拾Python 五
- 重拾Python 六
- 重拾Python 七
- 重拾Python 八
- 重拾Python 九
- 重拾Python 十
- 重拾Python 十一
- 重拾Python 十二
- 重拾Python 十七
- 重拾Python 十八
- 重拾python 十九
- 重拾python 三十一
- 重拾python 三十二
- cocos2dx C++使用rapidxml读取XML配置文件
- Mybatis的使用详解
- php中 判断变量 数组等数据 是否为空的方式
- 利用Eclipse创建maven项目并生成META-INF和WEB-INF目录
- 微信地理位置定位
- 重拾python 三十
- JQuery.validationEngine表单验证插件
- LINUX基本命令学习以及安装redis
- SSM项目启动报错:Failed to read candidate component class
- FreeRTOS9.0的移植-Keil-STM32F107VC
- ionic sqlite表的一些操作
- mysql查询更新时的锁表机制分析(只介绍了MYISAM)
- HBase最佳实践-HBase中的读性能优化策略
- 【工具】七牛图片基本处理imageView2实验