I have a feeling something is wrong


It says "way to go!" but I have a feeling something is wrong...
def hotel_cost(nights):
return 140*nights

    def plane_ride_cost(city):
        if city=="Charlotte":
         return 183
        if city=="Tampa":
         return 220
        if city=="Pittsburgh":
         return 222
        if city=="Los Angeles":
            return 475

    def rental_car_cost(days):
     if days>=7:
       cost=40 * days - discount
       print cost
       return cost
     elif days>=3:
       print cost
       return cost 
         print cost
         return cost

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


If I ask it to print instead, nothing happens


Our functions do not need to output anything, only return an object. Be sure to have the correct indentation or the interpreter may misinterpret your conditional branches and code blocks.

def rental_car_cost(days):
    cost = days * 40    # given
    if days >=7:
        cost -= 50
    elif days >= 3:
        cost -= 20
        # no discount so else branch not required
    return cost


Thought experiment - Python ternary expressions

This may not be applicable here, but it's worth a thought and some further reading...

def rental_car_cost(days):
    cost = days * 40
    cost -= 20 if days >= 3 else 0
    cost -= 30 if days >= 7 else 0
    return cost

print rental_car_cost(8)     #  270