# It keeps telling me that days are not defined

#1

Traceback (most recent call last):
File "python", line 24, in
NameError: name 'days' is not defined

I am struggling to define the function, it says days is not defined, how do I solve this?

``````def hotel_cost(nights):
# if it costs 140 a night
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_costs(days):
price = 40 * days
if days >= 7:
price1 = price-50
return price1
elif days <7  and days >= 3:
price2 = price-20
return price2

rental_car_costs(days)``````

#2

when calling the function, supply the numbers of days (which is an integer)

#3

You want to know what the cost of the car is during the days it is rented. You are definitely on the right track, just some small changes needed to be done.

1) On your `elif days < 7 and days >= 3:` function, the instructions state the following: "Alternatively (`elif`), if you rent the car for 3 or more days, you get \$20 off your total." It's not telling you to place an `and` operator. It's only asking for ">= 3" more days here.

2) On your function you have written:

``````def rental_car_costs(days):
price = 40 * days
if days >= 7:
price1 = price - 50
return price1``````

Let's clarify one thing here, and if this helps, it can then be applied to the next part of your other functions. As I mentioned at the very beginning you are wanting to know what the `price` would be for the car if it was rented for `>= 7:`days. So you are finding the new `price` and not a "price1" in the function. So if you can see that and makes sense, then you can apply the same idea to the next function.

Hope that helps!

#4

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