I have a feeling something is wrong


#1

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:
       discount=50
       cost=40 * days - discount
       print cost
       return cost
     elif days>=3:
       discount_two=20
       cost=40*days-discount_two
       print cost
       return cost 
     else:
         cost=40*days
         print cost
         return cost
         

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

#2

If I ask it to print instead, nothing happens


#3

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
    else
        # no discount so else branch not required
    return cost

#4

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