4/7 Need Help



Oops, try again. An error was raised for rental_car_cost(1): local variable 'cost' referenced before assignment

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


This is a comparison, not a definition. Write __ = ___.


Thank you! I totally confused.


This part is not needed since the condition above covers that interval.

Do you see the difference between an assignment and a comparison?


Do you have some resource recommended to keep studying after finishing this course?


I usually turn to the python docs and tutorials.

For sure you will do well to have a local environment to develop in. But if all you need for now is a sandbox, there are a few out there. This ons seems to be growing in popularity: repl.it


Yes, it is! thank you again!