Pull it together


why is this wrong?
def hotel_cost(days):
return 140*days
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
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 hotel_cost(days) + plane_ride_cost(city) + rental_car_cost(days)

Pull it together : A little adjustment that Worked!

I am getting this as a response:
Oops, try again. trip_cost('Los Angeles', 0) raised an error: cannot concatenate 'str' and 'NoneType' objects


Hi this part

def trip_cost(days,city):

Try to switch the argument first write city then days
like that

def trip_cost(city, days):


thanks easy to over look something like that


Hi, could you explain why it works after switching the input arguments in the trip_cost() function?


It has to do with the order in which the values appear in the function call expression.

print trip_cost("Charlotte",6)

In the first example above, days will be "Charlotte", and city will be 6. Not exactly what we planned for.