Taking a vacation - trip cost function


#1



Why does it think I deleted the trip cost function?


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(city, days, spencing_money):
    
    return hotel_cost(days) + plane_ride_cost(city) + rental_car_cost(days) + spending_money
    
    print trip_cost("Los Angeles", 5, 600)


#2

OK, I see the misspelling of spending money. But now I get Oops, try again.
It looks like nothing was printed to the console!


#3

Remove the indentation on the last line. print should be outside of the function block.


#5

I tried this exact code and I keep getting, "Oops, try again. trip_cost should take exactly 3 arguments!" I get this whether I have three arguments or not. Why is this happening?


#6

HI can you post your code?


#7

Your code should work , if you correct the misspelling and remove the indentation on the last line.


#8

Oh duh... I forgot to add spending_money to the line with def trip_cost(city, days, spending_money):
Haha, I am dumb


#9

my code does not working please give me suggestion..


#11

HI next don't post on an old post 1 month later you should create a new topic..

then

in your call function trip_cost() you wrote Loss Angeles instead of Los Angeles the same in plane_trip_cost()..


#12

thank you i got it :relaxed:


#13

Hi,
since now it technically isnt more than a month old anymore should i create a topic or can i post a question here?


#14

HI it's better if you create a new topic..


#15

ok tnx.. im will get right on it