#1

# I need help with this, i dont see why it doesnt work...

def hotel_cost(nights):
return 140 * nights
def planeridecost(city):
if city == "Charlotte":
return 183
elif city == "Tampa":
return 220
elif city == "Pittsburgh":
return 222
elif city == "Los Angeles":
return 475

# rental of cars

def rentalcarcost(days):
cost = 40 * days
if days >= 7:
cost = cost - 50
elif days >= 3:
cost = cost - 20

return(cost)

def tripcost(city, days, spendingmoney):
return rentalcarcost(days) + hotelcost(days) + planeridecost(city) + spendingmoney

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

#2

Never mind, i have the correct code now
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):
rental_car_cost = 40 * days
if days >= 7:
rental_car_cost -= 50
elif days >= 3:
rental_car_cost -=20

``return rental_car_cost``

def hotel_cost(days):
return 140 * days

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

#3

I'm trying...

def hotel_cost(days):
return 140 * days

def plane_ride_cost(city):
if city == "Charlotte":
return 183
elif city == "Tampa":
return 220
elif city == "Pittsburgh":
return 222
else:
return 475

def rental_car_cost(days):
if days >= 7:
return (days * 40) - 50
elif days >= 3:
return (days * 40) - 20
elif days < 3:
return days * 40

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

print trip_cost(4, "Charlotte")

Which runs and gives me the correct answer but I get an error message of "Oops, try again. trip_cost('Los Angeles', 6) raised an error: cannot concatenate 'str' and 'int' objects" So I'm stuck. I can't move to the next lesson and can't future out where I've gone wrong

#4

error: cannot concatenate 'str' and 'int' objects"

EDIT:
Forgot this part

``Oops, try again. trip_cost('Los Angeles', 6)``

END EDIT

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

print trip_cost(4, "Charlotte")``````