Everything is fine, it shows congratulations, but I still can't get the cost?!


The program is correctly executed as was confirmed by the software, however I don't really get the cost of the conditions provided.

def hotel_cost(nights):
    cost = 140
    return cost * 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):
    everyday_cost = 40
    normal = everyday_cost * days
    if days >= 7:
        return normal - 50
    elif days >= 3:
        return normal - 20
        return normal

def trip_cost(city, days, spending_money):
    sum = hotel_cost(days) + plane_ride_cost(city) + rental_car_cost(days) + spending_money
    #return sum
    print trip_cost("Los Angeles", 5, 600) 
    return sum 
    print trip_cost()

and the output on the console is none, why?

Replace this line with your code.


the function call should be outside the function? if you want to print what the function returns add print before the function call


There was a mistake in writing here, I have edited the post, I already added "print" before "return" and still I got "none"


the trip cost function call is still inside the function? place it after/outside the function


Yes! I got it, it was only a matter of spaces .. It should be WITHOUT any spaces!
Thank you very much


python relies on indent (spaces), so the spaces are rather important


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