第4个python程序:变量
来源:互联网 发布:栅格数据 编辑:程序博客网 时间:2024/05/21 19:43
[root@mysql1 pshell]# cat ex4.py
#!/usr/bin/env Python
#-*-coding:utf-8-*-
cars = 100
space_in_a_car = 4
drivers = 30
passengers = 90
cars_not_driven = cars - drivers
cars_driven = drivers
carpool_capacity = cars_driven * space_in_a_car
average_passengers_per_car = passengers / cars_driven
print "there are", cars , "cars available."
print "there are only", drivers, "drivers available."
print "three will be", cars_not_driven, "empty cars today."
print "we can transport", carpool_capacity, "people today."
print "we have", passengers, "to carpool today."
print "we need to put about", average_passengers_per_car, "in each car."
[root@mysql1 pshell]# python ex4.py
there are 100 cars available.
there are only 30 drivers available.
three will be 70 empty cars today.
we can transport 120 people today.
we have 90 to carpool today.
we need to put about 3 in each car.
#!/usr/bin/env Python
#-*-coding:utf-8-*-
cars = 100
space_in_a_car = 4
drivers = 30
passengers = 90
cars_not_driven = cars - drivers
cars_driven = drivers
carpool_capacity = cars_driven * space_in_a_car
average_passengers_per_car = passengers / cars_driven
print "there are", cars , "cars available."
print "there are only", drivers, "drivers available."
print "three will be", cars_not_driven, "empty cars today."
print "we can transport", carpool_capacity, "people today."
print "we have", passengers, "to carpool today."
print "we need to put about", average_passengers_per_car, "in each car."
[root@mysql1 pshell]# python ex4.py
there are 100 cars available.
there are only 30 drivers available.
three will be 70 empty cars today.
we can transport 120 people today.
we have 90 to carpool today.
we need to put about 3 in each car.
0 0
- 第4个python程序:变量
- 第5个python程序:变量2
- 第19个python程序:函数和变量
- 第18个python程序:命名变量代码函数
- 第25个python程序
- 第1个python程序:打印
- 第2个python程序:注释#
- 第7个python程序:打印
- 第8个python程序:还是打印
- 第10个python程序:转义
- 第11个python程序:接收输入
- 第12个python程序:提示输入
- 第7个python程序:更多打印
- 第13个python程序:参数
- 第15个python程序:读文件
- 第16个python程序:读写文件
- 第17个python程序:拷贝文件
- 第24个python程序:更多练习
- Postman输入List参数
- Java实现网页截图技术,根据URL得到网页快照
- C语言再学习 -- 循环语句
- 版本控制.gitignore文件写法
- HDU 1394 (树状数组)
- 第4个python程序:变量
- 查看thinkphp版本
- 如何给APK签名
- Android中的图片压缩
- CentOS 7 yum install zabbix 2.4
- 自定义的TextView,带有placeholder
- Codeforces Round #328 (Div. 2)C. The Big Race
- C++在dll中获取自身路径(非exe调用路径)
- 某公司测试题(二)---完全平方数最少