# Transportation

#1

``````def hotel_cost(nights):
return 140 * nights
def plane_ride_cost(city):
if city == "Charlotte":
return 183
elif city == "Tampa":
return 220
elif city == "Pittsburgh":
return 222
elif city == "Los Angeles":
return 475
def rental_car_cost(days):
cost == 40 * days
if days >= 7:
cost -= 50
elif days >= 3 and days <= 7:
cost -= 20
else:
return cost

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

I have no idea what I am doing wrong, if someone could please help me to understand what is going wrong.  Help a pal out... Thanks.``````

#2

this line:

``cost == 40 * days``

what is it suppose to do? (yes, i know what its suppose to do, but i would like to hear it from you)

#3

It means the cost of the rental car is equal to how many days the car is rented multiplied by the cost of the car (\$40).

#4

but cost is not yet defined, so how can it equal something?

usually we use is equal inside conditions (like `if` and `elif`), but in your case its not a condition?

The purpose of your function is to calculate how much it would cost to rent the car for `x` days.This means you need to calculate the \$40 * days, then apply discount, then return the total cost for renting a car

#5

Okay, I think I get it. Thanks!

#6