Error. Help appreciated!


#1

Taking a Vacation (6. Hey, you never know!)

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

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
    else:
        return "None"
   

def rental_car_cost(days):

    rent = days * 40
    
    if (days >= 3 and days < 7):
        rent -= 20
    elif (days >= 7):
        rent -= 50

    return rent
    
    
def trip_cost(days, city, money):
    
    spending_money = money * days
    
    return rental_car_cost(days) + plane_ride_cost(city) + hotel_cost(days) + spending_money

#2

Hi this part

def trip_cost(days, city, money):    
    spending_money = money * days

first you should add as parameter spending_money instaed of money then remove thsi line

    spending_money = money * days

#3

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