Transportation


#1



How can I fix this error?

https://www.codecademy.com/courses/python-beginner-P5YtY/1/3?curriculum_id=4f89dab3d788890003000096


Oops, try again. It looks like rental_car_cost returns 120 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
    else:
        return 0
     
def rental_car_cost(days):
    rent = 40 * days
    if days >= 7:
        return rent - 50
    elif days >3 and days <=6:
        return rent - 20
    return rent


#2

don't just return the operation but update your variable based on the condition,

if days >= 7:
        rent = (rent) - 50

same goes for your elif statement. :slight_smile:


#3

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