Holla Tech - Learn

Operator Precedence
 

Operator precedence is a very important concept in programming. It is an extension of the mathematical idea of order of operations (multiplication being performed before addition, etc.) to include other operators, such as those in Boolean logic.

The below code shows that == has a higher precedence than or

>> False == False or True
True
>>> False == (False or True)
False
>>> (False == False) or True
True 

 

NOTE!
Python’s order of operations is the same as that of normal mathematics: parentheses first, then exponentiation, then multiplication/division, and then addition/subtraction.

Operator Precedence
 

The following table lists all of Python’s operators, from highest precedence to lowest.

Holla Tech - Learn Python

NOTE!
Operators in the same box have the same precedence.

BACK NEXT

CLICK ON THE BUTTON BELOW TO GO TO THE PYTHON MAIN COURSE PAGE. 

PYTHON MAIN COURSE PAGE

 


©️ License: All Rights Reserved 


CONTACT HOLLA TECH – LEARN SUPPORT