I have a question about the notation used in the transportation section of the "taking a vacation" lesson.
When using if/elif to add discount to car rental cost depending on the days, i would have assumed the code would look like this:
def rental_car_cost(days): carcost = days * 40 if days >= 7: carcost - 50 elif days >= 3: carcost - 20 return carcost
However, this doesn't work. But when you copy the notation from the example and change the if/elif outcomes from "carcost - number" to "carcost -= number" it works:
def rental_car_cost(days): carcost = days * 40 if days >= 7: carcost -= 50 elif days >= 3: carcost -= 20 return carcost
I would just like to know why my first code wouldn't work, and what " -= " or "+=" means.
Thanks for your help!