Home>Article>Backend Development> What is the python operator precedence order?
#What is the order of precedence of python operators?
The order from high to low is: arithmetic operators, shift operators, bit operator precedence, relational operators, logical operators, Assignment operators
#1. The order of precedence in arithmetic operators is the same as in mathematical operations, multiplication and division first, then addition and subtraction.
#2. The priority of bitwise operators is lower than that of arithmetic operators, and the priority of shift operators is higher than that of bitwise operators.
#3. Relational operators have lower priority than bitwise operators and arithmetic operators.
#4. The priority of logical operators is lower than that of relational operators. The priorities from high to low are not, and, or.
#5. The assignment operator has the lowest priority.
6. For operators with the same precedence order, the order of operations is from front to back.
#7. You can change the priority order of operations through parentheses.
Recommended tutorial: "python tutorial"
The above is the detailed content of What is the python operator precedence order?. For more information, please follow other related articles on the PHP Chinese website!