Taking a Vacation 5/7 Pull it Together


#1

What's wrong with my code?

def trip_cost(city,days):
return rental_car_cost(days * 40)
return hotel_cost(days * 140)
return plane_ride_cost(city + city)

it says
Oops, try again. trip_cost('Los Angeles', 4) returned 6350 instead of the correct value 1175


#2

Hello, I don't know what's wrong, without the intermediate cost details.
Following code gives the result of 1175 with your inputs

Hope it could helps

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:
        cost = cost - 50
    elif days >= 3:
        cost = cost - 20
        
    return cost
    
def trip_cost(city, days):
    return rental_car_cost(days) + hotel_cost(days) + plane_ride_cost(city)

#Test
print trip_cost("Los Angeles", 4)

#3

your trip_cost function must have an argument of spending_money. And also, it's 5days not 4

my total_cost function is:

def trip_cost(city, days, spending_money):

return rental_car_cost(days) + hotel_cost(days) + plane_ride_cost(city) + spending_money

and my last line of code:

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


#4

I have the same code and it doesn't work