I have lost my way on the "Transportation" module


HI! I am hoping someone can help me with this exercise.

I keep getting an error message that says "Oops, try again. It looks like rental_car_cost returns 120 instead of the correct amount (100) for 3 days."

I have tried to change the code a couple times, and I keep getting the same message.

def rental_car_cost(days):
    cost = 40 * days
    if days >= 7:
        discount_1 = 50
        cost - discount_1
    elif days >= 3:
        discount_2 = 20
        cost - discount_2
    return cost


take a look at this code:

example = 50
print example - 20
print example
example = example - 20
print example

you get the idea? just doing cost - discount_x isn't enough, that won't persist. You need to update the cost variable


I do. Thanks. For some reason, that really made a lot of sense to me.



Where is the indent problem here?
PLEASE REPYLY :confused:


you will have to copy paste your code to the forum, the url is the same for everyone, it checks for user


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 cost -50
    elif days>=3:
        return cost -50
        return cost

^here it is


this line:


you should use a single equal sign to assign a value of 40*days to cost. The discount should be 20 for 3 till 6 days, not 50

if days is less then 3, nothing is returned. return cost (last line) is wrongly indented


Done with your inputs.Thankyou so much. ^.^