# Plan Your Trip!

#1

Hey guys,

Sorry if this is a very simple answer I am still very new to Python and coding in general. I'm not having any issues with completing the tasks but I am having issues fully understanding what I am doing. In my code for the exercise you complete it by entering print trip_cost("Los Angeles", 5, 600). I understand how Python can reference back "Los Angeles" but I dont understand how it assumes 5 for days and adds 600 into the extra cost of the trip. My only thought is that trip_cost must be a set function? Sorry again if this is very simple concept and if this is the wrong place to submit this. Any feedback is appreciated.

Here is my code for reference:

``````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 = days * 40
if days >= 7:
cost = cost - 50
elif days >= 3 and days < 7:
cost = cost - 20
return cost
def trip_cost(city, days, spending_money):
return rental_car_cost(days) + hotel_cost(days) + plane_ride_cost(city) + spending_money
print trip_cost("Los Angeles", 5, 600)``````

#2

``def trip_cost(city, days, spending_money):``

you have 3 parameters, for each parameter you need to supply an argument:

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

the arguments are copied into the parameter:

``````city = "Los Angeles"
days = 5
spending_money = 600``````

what is the struggle?

#3

Sorry I didn't communicate this very well when posting this last night. My issue I think is lack of understanding of the program itself or its possible that I am missing theory somewhere. What I didn't understand is that trip_cost is a user defined function. Now looking at it a little more attentively I see on the line following return cost, that we are use the header def to define the function trip_cost. In here we include the parameters and their matching arguments. Sorry for posting something trivial. I'm going to blame working on this till 7am as the contributing factor.

#4

and what is your question for me?

#5

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