Pull it together


#1



pull it together


Oops, try again. trip_cost('Pittsburgh', 2) raised an error: unsupported operand type(s) for -=: 'str' and 'int'


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
    elif city == "Los Angeles":
        return 475
    
def rental_car_cost(days):
    cost = 40 * days
    if days >= 7:
        cost -= 50
    elif days >= 3:
        cost -= 20
    return cost

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


#2

look at the function call the exercise execute:

trip_cost('Pittsburgh', 2)

now look at your function parameters::

def trip_cost(days, city):

notice anything? hint: i am going to 2 for pittsburgh days


#3

3 posts were split to a new topic: Pull it together


#6

2 posts were split to a new topic: Pull it together


#7

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