Transportation function error


#1



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


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


#2

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?


#3

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:


#4

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