Transportation


#1




Error message reads "It looks like rental_car_cost returns 120 instead of the correct amount (100) for 3 days."

So the problem seems to be that it won't subtract the discount from the total

i was hoping the if/elif would take the days times 40 (which is done after the def if called?) and then have it subtract the discount if there was any


def hotel_cost(nights):
    return 140 * nights
    
def plane_ride_cost(city):
    if city.lower() == "charlotte":
        return 183
    elif city.lower() == "tampa":
        return 220
    elif city.lower() == "pittsburgh":
        return 222
    elif city.lower() == "los angeles":
        return 475
    else:
        return "error",
        
def rental_car_cost(days):
    return days * 40
    if days >= 7():
        return days - 50
    elif days >= 3 and days < 7():
        return days - 20


#2

So basically it seems you forgot this in the instructions: "Calculate the cost of renting the car:" And I emphasize cost. Some of your return statements need to be changed to the cost like in return days * 40. Also, so of your numbers are off as well like - 50. I recommend going back over this completely through the instructions focusing on 02.) through 07.) and if you need a basic outline or more help just let me know!


#3

Thanks. I stared over and added cost to the function. Got another error but going to try to figure it out by myself before I ask.

Thanks a lot :slight_smile:


#4

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