Taking a Vacation
Pull it Together

Great! Now that you've got your 3 main costs figured out, let's put them together in order to find the total cost of your trip.

def double(n):
    return 2 * n
def triple(p):
    return 3 * p

def add(a, b):
    return double(a) + triple(b)
  1. We define two simple functions, double(n) and triple(p) that return 2 times or 3 times their input. Notice that they have n and p as their arguments.
  2. We define a third function, add(a, b) that returns the sum of the previous two functions when called with a and b, respectively.
  1. Below your existing code, define a function called trip_cost that takes two arguments, city and days.
  2. Like the example above, have your function return the sum of calling the rental_car_cost(days), hotel_cost(days), and plane_ride_cost(city) functions.

It is completely valid to call the hotel_cost(nights) function with the variable days. Just like the example above where we call double(n) with the variable a, we pass the value of days to the new function in the argument nights.

Stuck? Get a hint! Hint
Get live, fast support from Codecademy Advisors when you get stuck. Learn more.

For the purposes of this exercise, the number of nights you stay in the hotel will always be the same as the number of days you rent the car.