# 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.")
笨方法学习Python-习题4:变量(variable)和命名
最新推荐文章于 2024-06-25 02:01:53 发布