In Java or C we have <condition> ? X : Y, which translates into Python as X if <condition> else Y.
But there's also this little trick: <condition> and X or Y.
While I understand that it's equivalent to the aforementioned ternary operators, I find it difficult to grasp how and and or operators are able to produce correct result. What's the logic behind this?