Taking a Vacation # 4 Transportation


#1

def hotel_cost(nights):
cost = 140*nights
return cost

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):
if days >= 7:
cost = (40*days)-50
return cost
elif days >=3:
cost = (40*days)-20
return cost

It returns this error:
Oops, try again. It looks like rental_car_cost returns None instead of the correct amount (40) for 1 days.

Before I rip my hair out, I need someone to the rescue!


#2

I got it! I got it! I got it! Just following the rules using up the 20 characters here lol


#3

i don't get it. help please


#4

for god sake
type complete code


#5

I don't get it. I have the same error, but I don't see what the problem is. Would you please tell me what I did wrong? My code looks exactly like yours from your first post above.


#6

what do you mean when you say you are "Just following the rules using up the 20 characters here"


#7

You need to define cost cost before the "if days >=7:
There seems to be some other errors in your code where you have been inconsistent on the return function

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