Return on the car_rental_cost


#1


taking a vacation, transportation

There is something wrong with the car_rental_block


 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
    else:
        return 0

def rental_car_cost(days):

    return total == 40 * days

    if days >= 7:
        total - 50
        return total
    elif days >= 3:
        total - 20 
        return total
    else:
        return 0

hotel_cost(2)
plane_ride_cost("Tampa") 
rental_car_cost(2)


#2

Hello, @cloudjumper27938,

You shoudn't return total == 40 * days. You can either set total to 40 * days and return it on a separate line, or just directly return the value itself. Also, your code isn't working because you are directly returning the value, before the function can even move on to your if statement.


My suggestion?

Return total on the else statement of your if statement.


#3

You could do that i went about it with another approac. You shouldn't return the total on your if or your elif
only at the bottom atleast that fixed my problem.


#4

I won't put the correct code into this for the sake of you doing on your own but you also need something in the totals with the - sign do you know what that is?


#5

Thanks everyone I got it.