Taking a vacation : putting all together (my codes compile shows error)


#1

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:
        return cost - 50
        
    elif days >=3:
        return cost - 20
        
    return cost
    
def trip_cost(days, city):
        sum=hotel_cost(days) + plane_ride_cost(city) +                 rental_car_cost(days)
        print sum
        return sum
#ends here        
trip_cost(2,"Tampa")

#2

print if you wish to see any output.

print trip_cost(2,"Tampa")

#3

you call the function like this:

trip_cost(2,"Tampa")

however, the exercise will also call your function multiply times (to see if the code works), but they provide the city as first argument, and days as second argument, so in your function declaration:

def trip_cost(days, city):

you should swap your parameters (city,day)


#4

thanks a lot sir it solved my problem thanks you sir