# Calculating rental_car_cost

#1

calculating rental_car_cost

Error message reads "Oops, try again. It looks like rental_car_cost returns 120 instead of the correct amount (100) for 3 days."

I can't figure out where I went wrong with my code. I'll also point out that I'm experimenting with the 3 <= days <= 6 to see if that is valid, which I can't see yet. If it is not valid, then I will change that to days == 3 or 4 or 5 or 6. But I'm sure there is a better way than that.

``````def rental_car_cost(days):
if days == 1 or 2:
return days * 40
elif 3 <= days <= 6:
return days * 40 - 20
elif days >= 7:
return days * 40 - 50``````

#2

Lol, I just realized that the error is on the same line, but I changed it to elif days == 3 or 4 or 5 or 6
return days * 40 - 20, but like before it still didn't work.

#3

Calculate the cost of renting the car:
Every day you rent the car costs \$40.

so at first calculate the total value.like

`total=40*days`

now if you rent the car for 7 or more days, you get \$50 off your total.

here you did

`if days == 1 or 2:`

what does this mean?i cant understand why did you take`days == 1 or 2` you just have to check if days are more than or equal to 7

so i would do like

`if days >= 7:`

now you get \$50 off your total.how can i get it? think

and you can see the example too in this lesson.understand that

#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.