Hey, You Never Know... Whats wrong with my code?


#1


Taking a Vacation >> Hey You Never Know

Oops, try again. trip_cost('Tampa', 5, 0) raised an error: spending_money() takes exactly 1 argument (0 given)


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):

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

    return maincost
    
#####################################

def spending_money(money):
    
    return money

#####################################

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


#2

inside the trip_cost function, spending_money is just a variable you have to add to the total, not a function call

where did you get the variable nights from all of a sudden? Try using days

You changed the code while i was helping you, confusing. No need to create a spending_money function


#3

Thank you so much! That fixed it :slight_smile:


#4