Taking a Vacation


#1

Please help I am stuck in the part where you print all of the values and it is showing an error please help

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 plane_ride_cost(city) + rental_car_cost(days) + hotel_cost(days) + spending_money()
print trip_cost("Los Angeles",5,600)


#2

Okay, perhaps the error is saying something that you can look into?
In any case, we can't run your code if you don't make sure that it's intact in your post.


#3

Hey, I just checked out your code. it seems you added spending money at the very end in your trip cost. I've been correcting a few people. I wonder who added that. it's not necessary. Also the (trip_cost) is required to have just 2 values not 3 ex: (city,days) only. anyways here's a slightly modified code that should work for you. with spending_money removed. Oh, don't forget to indent all the right places before submitting.

cost per night at the hotel

def hotel_cost(nights):
cost_hotel= nights*140
return cost_hotel
print hotel_cost(6)
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):
if days >= 7:
return (40*days) - 50
elif days >= 3:
return (40*days) - 20
else:
return 40*days

def trip_cost(city,days):
return hotel_cost(days) + plane_ride_cost(city) + rental_car_cost(days)
print trip_cost('Los Angeles',5)


#4

delete the brackets

and then it should work fine