Taking a Vacation


#1



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


I know the trip_cost function is supposed to have only two arguments, but if hotel_cost takes the argument 'nights' and rental_car_cost takes the argument 'days' , which are two separate arguments, why is it asking for only two arguments? I can get it to run but it still says it's incorrect...


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):
    total= 40*days
    if days>=7:
        total-=50
    elif days>=3:
        total-=20
    return total
    
def trip_cost(city,nights,days):
    return hotel_cost(nights)+rental_car_cost(days)+plane_ride_cost(city)
    
print trip_cost('Tampa',5,3)


#2

It only needs two pieces of information, aka, data, days and city so there are only two arguments in the function call.

Take out the nights parameter.


#3

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