代码拉取完成,页面将自动刷新
# _*_ coding: utf-8 _*_
# 有 100 辆车
cars = 100
# 每辆车上可以作 4 个人
space_in_a_car = 4.0
# 有 30 个司机
drivers = 30
# 有 90 个乘客
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 ("There 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.")
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。