# Vacation code was working until i added the last 'def'

#1

to the right of this box. That is how your post will look to everyone else.>

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

Oops, try again. trip_cost('Pittsburgh', 4) returned 362 instead of the correct value 922

return the sum

``````def hotel_cost(nights):
return 140 * nights

def plane_ride_cost(city):

if city == "Charlotte":
return 183
if city == "Tampa":
return 220
if city == "Pittsburgh":
return 222
if city == "Los Angeles":
return 475

def rental_car_cost(days):

rentalcarcost = 40 * days

if days >= 7:
return rentalcarcost - 50

elif days >= 3:
return rentalcarcost -20

else:
return rentalcarcost

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

• List item

#2

After an if, it should follow with as many elif as desired.

Kindly review this.

Also, the parameter for *hotel_cost()** should be days and not what you have here:

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

EDITED: Last block of code review.

#3

THANK YOU!!!! bayoishola20 for your help, time and consideration
it worked...

in explanation, for me.,.,.,, as i ran the 'if' for each line, each 'if' was a separate statement, rather than evaluating by down by an 'elif', is this true, i want to understand what the function is.

thanks again bayoishola20

#4

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