Transportation Stuck, Help please


#1



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


I'm getting the error "Oops, try again. It looks like rental_car_cost returns 40 instead of the correct amount (80) for 2 days." but if i swap the days to 2 and send the output as 80 i get "Oops, try again. It looks like rental_car_cost returns 80 instead of the correct amount (40) for 1 days."


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


#2

That is a constant. Something amiss, there.

Which constraint must be followed moving forward. If days is expected to be a variable then we will not wish to set it to a fixed value.


#3

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