Taking a Vacation Pull it together


#1


Hi Everyone

Not sure what is wrong with the below the code


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


#2

Well first off, why did you put your whole print in quotes? get rid of those extra quotes around trip and 600) !


#3

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 -= 50
elif days >=3:
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)

I AM HAVING THE SAME ISSUE
NOTHING WAS PRINTED IN THE CONSOLE.


#4

It still doesn't seem to work
def hotel_cost(nights):
return 140 * nights
def plane_ride_cost(city):
if city == "Charlotte":
return 183
elif city == "Tampa":
return 220
elif city == "Los Angeles":
return 475
elif city == "Pittsburg":
return 222
def rental_car_cost(days):
cost = 40*days
if days >= 7:
cost -= 50
elif days >=3:
cost -= 20
return cost
def trip_cost(city,days,spending_money):
trip_cost = hotel_cost(days) + plane_ride_cost(city) + rental_car_cost(days) + spending_money
return trip_cost
print trip_cost("Los Angeles",5,600)


#5

Don't put

inside the trip_cost function, since it uses trip_cost.

And don't put all of your print in quotes.


#6

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