Rental car


#1

I did same but still getting same error (did i define rental_car_cost)

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

4/7 Did I define rental_car_cost
#2

here:

cost == 40*days

you should assign cost a value of 40*days, assigning is done with a single equal sign, two equal signs is used for comparing if values are equal

and the rental car cost function should be after your plane_ride_cost function, not nested inside (hint: change the indent)

if you need more help, post an updated version of your code


#4

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