我函数中的print(trip_cost)没有打印结果。 如何获得与raw_input变量相关的结果?
我认为输入可能是问题所在,还是最后一个问题。
这是我的代码:
nights = raw_input('How many nights will you stay: ')
def hotel_cost(nights):
return 140 * nights
city = raw_input('Choose your destination: ')
def plane_ride_cost(city):
if city == "Charlotte":
return 183
elif city == "Tampa":
return 220
elif city == "Pittsburgh":
return 222
elif city == "Los Angeles":
return 475
days = raw_input('For how many days will you need the car: ')
def rental_car_cost(days):
cost = 40 * days
if days >= 7:
cost -= 50
elif days >= 3:
cost -= 20
return cost
def trip_cost(days, city):
return rental_car_cost(days) + hotel_cost(days-1) + plane_ride_cost(city)
print(trip_cost)
期望根据我给的答案找到旅行的费用 夜/城市/天。 不打印
谢谢