笨方法学习Python-习题4:变量(variable)和命名

来源:互联网 发布:社区控烟网络会议记录 编辑:程序博客网 时间:2024/06/06 03:31
# coding=utf-8# 车辆数量cars = 100# 一辆车的空间space_in_a_car = 4.0# 司机数量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# 100辆车print("There are",cars,"cars available.")# 30个司机print("There are only",drivers,"drivers available.")# 70辆车空闲print("There will be",cars_not_driven,"empty cars today.")# 今天可载客120人print("We can transport",carpool_capacity,"people today.")# 90个乘客print("We have",passengers,"to carpool today.")# 在每辆车内有3名乘客print("We need to put about",average_passengers_per_car,"in each car.")

阅读全文
0 0