笨办法学python(第三版)习题_4

相关主题
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

?cars = 100 #有100辆车
space_in_a_car = 4.0 #每车乘坐4人
drivers = 30 #有30个司机
passengers = 90 #有90个乘客
cars_not_drivers = 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, "adrivers available."
print "There will be", cars_not_drivers, "empty cars today."
print "We can trnsport", carpool_capacity, "people today"
print "We need to put about", average_passengers_per_car,"in each car"

相关文档
最新文档