5/7 Error


#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):
rent = 40 * days
if days >= 7 :
rent -= 50
elif days >= 3:
rent -= 20
return rent

def trip_cost (city,days):
sum = plane_ride_cost(city) + rental_car_cost(days) + hotel_cost(days)

Whats wrong?


#2

I don't want to give you the answer directly, but (provided your indentation is good) take a look at

def trip_cost(city, days):

I think you have all the information you need to return a value, but

sum = plane_ride_cost(city) + rental_car_cost(days) + hotel_cost(days)

doesn't do that.

Maybe if you could group all the values together with parentheses

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

and find some way to return that value? :wink:

Good luck!