I have lost my way on the "Transportation" module


#1



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


#2

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


#3

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


#4

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

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


#5

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


#6

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

^here it is


#7

this line:

cost==40*days

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


#8

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