Transportation


#1



it tells me that rental_car_cost returns none instead of the correct amount (100) for 3 days


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


#2

You only return cost in your else statement. You can remove the else statement, and place return cost in the main body of rental_car_cost.


#3

now it tells me its 120 instead of (100) for 3 days.


#4

try updating your cost variable based on each conditional (look at the example). The cost is lowered for longer trips so if there are at least 7 days then cost -= 50 (cost is cost - 50)


#5

cost -= the discount worked! Thanks!


#6

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