The given solution is incorrect


#1

codecademy says that the following code is correct, but if you were actually going on a vacation you would spend EXACTLY 1 NIGHT LESS ON VACATION THAN THE NUMBER OF DAYS ON VACATION. codecademy says that you should sum hotel_cost(days) with everything else, BUT THAT IS COMPLETELY INCORRECT AS IT SHOULD INSTEAD SUM hotel_cost(days - 1) INSTEAD. If you went on a 1 day vacation, you would NOT spend 1 night. If you spent 1 night, you would have to spend 2 days, the one before that night, and the one after that night. Similarly, if you spend 5 days on vacation, you would only rent the hotel for 4 nights. Whoever thinks that you should rent the same number of nights as you have days is going to END UP WASTING GOOD MONEY PAID FOR BY HOURS OF STULTIFYING LABOR because they will have booked either the night BEFORE they leave for their vacation or the night AFTER they have finished their vacation.

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

def trip_cost(city, days):
    return hotel_cost(days) + plane_ride_cost(city) + rental_car_cost(days)


#2

What if you leave first thing in the morning? Or arrive at night.
Or both?

They're all arbitrary gotta pick one and having them equal is simplest, isn't it? They're all correct.


#3

You have to use the rented car to drive from the hotel to either home or to the airport AND from the airport or your home to the hotel. Therefore if you are using a rental car - which the problem is assuming - you have to have the car BEFORE you check into the hotel so you can drive to the hotel, and AFTER the last night in the hotel so you can drive back to where you came from. Your only other option would be to turn in the car before your last night in the hotel, in which case you would have to walk to the hotel from the rental place, and then from the hotel to the airport the next morning.