Car rental is producing strange errors


#1

So the thing is that when the computer gets to this line of code

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

It says that when the days are = to 3 the returned rent is 120 not 100 but in my code it says to minus the rent by 20 so it would be = to 100. What is wrong with my code.


#2

Try changing that to

elif days > 3:

#3

hope this helps.


#4

Thank you for helping, but could you just give hints or snippets of code next time?

I ask this because it helps people learn more if you tell them where their mistakes are, why they're mistakes, and how to fix them, as opposed to just copying code that they don't understand.

Thanks,
JibblyJ


#5

@si_fiwizard

In case you didn't get it from their answers, you never changed the rent, just executed some math. You use minus (-) instead of increment down (-=)

What you needed for the lines within the if and elif statements were rent -= 50 or 20 depending on which dollar amount you were changing rent by


#6

Thanks for the answer.