Taking a Vacation


#1



https://www.codecademy.com/en/courses/python-beginner-P5YtY/1/5?curriculum_id=4f89dab3d788890003000096


it calls me to calculate the result of trip_cost, by adding a a third argument. but I don't know how to def the argument. Who can kindly tell me how to do it? thanks a lot!


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

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 trip_cost(city,days,spengding_money):
    return rental_car_cost(days) + hotel_cost(days) + plane_ride_cost(city)


#2

Problem1.

trip_cost(city,days,spengding_money)

You misspelled.
Its spending_money

Problem2.

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

You forgot to add this extra money (spending_money) to final sum?


#3

jajaja, thanks a lot.


#4

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