PULL IT TOGETHER help


#1



https://www.codecademy.com/courses/python-beginner-P5YtY/1/4?curriculum_id=4f89dab3d788890003000096#


rental_car_cost(7) returned 210 instead of the correct value 230


Replace this line with your code. 
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
    if days >= 3:
        cost -= 20
    return cost 
def trip_cost(city, days):
    return hotel_cost(nights) + plane_ride_cost(city) + rental_car_cost(days)


#2

renting a car for 7 days will give both 50 and 20 dollar discount, that is not suppose to happen

renting a car for 7 days should only give 50 dollars discount


#3

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:
cost -= 20
return cost
def trip_cost(city, days):
return hotel_cost(nights) + plane_ride_cost(city) + rental_car_cost(days)


#4

that should do the trick, does it work?


#5

trip_cost('Charlotte', 9) raised an error: global name 'nights' is not defined


#6

I changed nights to days and it worked


#7