Operator precedence | SoloLearn: Learn to code for FREE!


Operator precedence

In the python course, control structures, the operator precedence part: It seems from the question that follows it (as I found on another website) that OR takes precedence over AND and NOT, yet in the list of operator precedence these 3 get grouped together on the same line.

9/15/2017 9:32:32 AM

Fabian de Korver

4 Answers

New Answer


you can send suggestions to [email protected](if not mistaken). regarding, tag, I do not know for sure. you can insert post as reference. the easiest way, is to create comment in the course. (you can post what I wrote , I will not claim author rights :)


https://docs.python.org/3/reference/expressions.html Look at the table at the bottom of the page.


try this in code playground and get the feelings. print(not True or False and True) the rule of thumb is not a is like -1 for numbers a and b is :like (1*0), works like multiplication, and is before addition, a or b is like addition (1+0) so ( - 1 + 0 * 1) should be false


🇹🇭Nithiwat🇹🇭 that was the website I was talking about. yuri, first time I've seen it compared to numbers, makes it easier to see why certain operators should go first. Maybe they should add this precedence in the part of the course I referenced? Cause currently it seems like there is no precedence, like with plus and minus in math. ps: is there a way to tag or quote people?