4/7 need help


#1



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


an error was raised for rental_car_cost(1): global name 'cost' not defined


def rental_car_cost(days):  
    cost - days * 40
    if days <= 7:
        cost - cost -50
        return cost 
    elif days < 7 and days >= 3:
        cost - cost - 20
        return cost
    else:
        return cost;


#2

Ok, let me ask you a question, what is the meaning and purpose of this line:

cost - days * 40

?


#3

I do not known why I put it their. @factoradic but deleted it and it still did not work.


#4

Well, I never said that you should delete this line.

The base cost of the rental is calculated by this formula:

cost = days * 40

You see? You have used - in place of the =.


Same thing happens in the few next lines.


#5

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