Messed Up do not reply


Oops, try again. trip_cost('Tampa', 0) raised an error: cannot concatenate 'str' and 'int' objects

no error message

Replace this line with your code.


code: def hotel_cost (nights):
return 140 * nights
def plane_ride_cost (city):
if "Charlotte" == city:
return 183
elif 'Tampa' == city:
return 220
elif 'Pittsburgh' == city:
return 222
return 475
def rental_car_cost (days):
if days >= 7:
return days * 40 -50
elif days >= 3:
return days * 40 -20
return days * 40
def trip_cost(days, city):
return hotel_cost(days) + plane_ride_cost(city) + rental_car_cost (days)


your function arguments and parameters are positional, so when the exercise validates your function works correctly by calling the function, the first is argument is Tampa which get passed into the first parameter days, and 0 will be passed into city.

hotel_cost can't handle Tampa as argument, same for plane_ride_cost and rental_car_cost


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.