trip_cost should take exactly 2 arguments!


can someone help me? i dont know what’s wrong with my code

def hotel_cost(nights):
 return 140 * nights

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):
  return cost - 50
 elif(days >= 3):
  return cost - 20
  return cost

def trip_cost(city, days, spending_money):
 return hotel_cost(days) + plane_ride_cost(city) + rental_car_cost(days) + spending_money

print trip_cost("Los Angeles",5,600)


Please format your post as I have done (select entire code block; press Ctrl+Shift+C) from next time. Thanks! :slight_smile:

As it’s pretty obvious from the error, trip_cost should take exactly two arguments, and you have got three in your definition (city, days, spending_money). Read the instructions carefully again.


Do you still have a problem with this task, because I copied your code, run it and it went smooth.


no, i don’t anymore. :smile:


I suppose you had this trouble on the fifth exercise, right? Because the next exercises expect trip_cost to have three arguments.