还是先上程序
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
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."
这里要注意的是最好多来点空格吧,=左右,+-*/左右,比不打空格好看多了。
单词不要打错了,还好VS Code有自动补完功能,太方便了
结果自然就是想要的,如果发现有误,仔细检查一下
=================================================================
附加练习
1、4.0和4里面无非是整形和浮点的区别。。。只用4那就没小数点了