Rental car cost


#1



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

"It looks like rental_car_cost returns 120 instead of the correct amount (100) for 3 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):
    return days * 40
    if days >= 7:
        return  days * 40 - 50
    elif days >= 3:
        return days * 40 - 20


#2

Perhaps change the elif statement for if the car is rented for between three and seven days. Then an else statement to cover everything else.

EDIT: Also, your code stops running as soon as it hits the return statement.


#3

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