Transportation function error


it says "Oops, try again. Did you create a function called rental_car_cost? "

I'm pretty sure that my code doesn't have that error help plz

def rental_car_cost(days):
        days = 40 * days
        if days >= 7:
            days -= 50
        elif days >= 3:
            days -= 20
        return days


The idea is to find the cost of a rental car based on the number of days you rent it. Your function's argument is the number of days the car is rented, so perhaps the first variable you set in the function shouldn't be named 'days'. Perhaps 'cost' would be better?


price = days*40
    return price

You need to call these two lines with different variable names, because what you were doing was overwriting them. :grin:


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