4/7 help


#1

def rental_car_cost(days):
cost = 40 * days

if days >= 7:
return cost -= 50
elif days >= 3:
return cost -= 20

    return cost

I do not get what I am doing wrong?????


#2

Make sure you are indenting properly
Also no need for the -= in the return cost.
And you need the else: statement for your return cost

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

#3

Every time after every "if/elif/else" you need return value so for this one you need write "return cost"
This is right code:

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