Need help with taking a vacation: Pulling It Together


#1

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
        return cost
    elif days<7 and days >=3:
        cost = cost - 20
    else:
        return cost

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

Here is my code can anyone see what's the problem with it. Thanks.


#2

your rental_car_cost function only return the cost if the car is rented for less then 3 days

your function should always return how much it would cost to rent a car


#3

thank you stetim for your answer i'll try that instead.


#4

Also, the return statement at the bottom does not need the set of parentheses around the whole thing.


#5

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