5 AnswersNew Answer
'and' is before 'or' in every programming language. There is an order of operations just like in math. https://en.m.wikipedia.org/wiki/Order_of_operations#Programming_languages
arr = [1, True, 'a', 2] print('a' in arr in arr) Output is false. While: print(('a': in arr) in arr) Output is true Schindlabua Henri Evjen Is python right to left without brackets for 'in' operations?
I don't write much python, but looks like it. Right-associativity is not terribly uncommon though. Think of `a ** b ** c`, or in other languages, `a ? b : c ? d : e` or `a = b = c`.
Thanks. Cool eye opener. *Not every programming language though. There are exceptions.
Even cooler: `and` is like multiplication and `or` is like addition in a pretty strict mathematical sense. true behaves a bit like 1, false like 0: true and true == true 1 * 1 == 1 false and true == false 0 * 1 == 0 false or false == false 0 + 0 == 0 false or true == true 0 + 1 == 1 (with 1+1 we have to squint a little to see it.) And of course multiplication goes before addition :)