|
本人菜鸟,在学笨方法学python时习题4遇到:
# -*- coding: utf-8 -*-
cars =100,#汽车被赋值恒为100辆。
space_in_a_car=4.0,#_是下划线字符,在变量里通常被用作假想的空格。
drivers=30,#司机被赋值30.
passengers=90#乘客被赋值90.
cars_not_driven=cars-drivers
cars_driven=drivers
carpool_capacity=cars_driven*space_in_a_car
average_passenger_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,"peopel today."
print "We have",passengers,"to carpool today."
print "We need to put about",average_passenger_per_car,"in each car."
运行错误,Traceback (most recent call last):
File "ex4.py", line 6, in <module>
cars_not_driven= cars-drivers
TypeError: unsupported operand type(s) for -: 'tuple' and 'tuple'
是什么意思,百度不出来,求指教,谢谢大家。
|
|