Taking a vacation


#1




error message:
File "python", line 26
return spending_money + hotel_cost(days)+ plane_ride_cost(city) + rental_car_cost(days)
^
IndentationError: expected an indented block


def hotel_cost(night):
    return 140 * night

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,spending_money):
    
return spending_money + hotel_cost(days)+ plane_ride_cost(city) + rental_car_cost(days)


#2

@dilbertron ,

You must indent this line for it to belong to the trip_cost function ...

return spending_money + hotel_cost(days)+ plane_ride_cost(city) + rental_car_cost(days)

#3

now i added this line after everything...

print trip_cost("Los Angeles", 5, 600)

now it says Oops, try again.
It looks like nothing was printed to the console!
i bet its something really obvious but im too dumb to figure it out


#4

Make sure not to indent this line because it should not be part of the function ...

print trip_cost("Los Angeles", 5, 600)

#5

I told you it was something obvious! but thanks anyway :smile:


#6

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