当我运行以下代码时,得到如下错误:
trip_cost should take exactly three parameters: city, days, and spending_money (in that order).
下面的代码具有与前面所述相同的参数顺序。但仍然得到同样的错误,即使它返回1995年的旅行费用
def plane_ride_cost(city):
if city == "Charlotte":
return 183
elif city == "Tampa":
return 220
elif city == "Pittsburgh":
return 222
elif city == "LosAngeles":
return 475
def rental_car_cost(days):
cost = 40
if days >= 7:
return (cost * days - 50)
elif days >= 3 < 7:
return (cost * days - 20)
elif days < 3:
return (cost * days)
def hotel_cost(nights):
return 140 * nights
def money(spending_money):
return spending_money
def trip_cost(city,days,spending_money):
total_trip_cost = plane_ride_cost(city) + rental_car_cost(days) + hotel_cost(days) + money(spending_money)
return total_trip_cost
print trip_cost("LosAngeles",5,600)
目前没有回答
相关问题 更多 >
编程相关推荐