And or Or


Oops, try again. It looks like rental_car_cost returns 20 instead of the correct amount (40) for 1 days.

I have played with this code which looked right; well certainly the math did!

Based on the information provided and the use of the word OR, I input the code expecting a pass; however, it kept giving the above error message..

Line 18 was the culprit!!

"elif days >= 3 and days <= 6:" I originally had "or" instead of "and". can you help me to understand why I need the "and", as I am having trouble getting my head around it.

Replace this line with your code. Do not remove the backticks that are above or below this line.


    elif days >= 3 and days <= 6:
        return 40 * days - 20


I think I understand; would my understanding be correct?

elif days >= 3 and days <= 6:
    return 40 * days - 20    # Both have to be true


Did you pass? Your understanding seems to be correct :slightly_smiling:


or requires one statement true to run the code so if days >= 3 it can be even 7 or if days<=6 it can be even 1 by saying and you stating the range between 3 and 6


Yes, it passed. I was just struggling with understanding the reason for the "Or" and the "And" even though I have completed the boleen lessons. I need to try and understand before moving on.


Booleans can be so tricky, you have to practice a lot to get the hang of it. It feels counter intuitive, i know.