Python commonly used operators are: arithmetic operators, logical operators, comparison operators, respectively, described below.
1. Arithmetic operator
+ addition operator
-Subtraction operator
* Multiplication operator
/Division operator (Precise operation)
Division operator (the result is an integer that ignores the fractional part of the calculation result)
* * Power operator, or exponentiation operation
% modulo operator, which is the remainder
2. Comparison operators
> Greater than
>= greater than or equal to
< less than
<= less than or equal to
= = equals
! = does not equal
3. Logical operators
Not means to negate
and Logic and
or logical OR
4. Precedence of various operators
1) Overall: The arithmetic operator is higher than the comparison operator, and the comparison operator is higher than the logical operator.
2) Specific,
Arithmetic operators: Follow the mathematical law, single-specific to the power operator is special, the power operator * * Priority is higher than the left of the monocular operator (such as-minus), lower than the right of the monocular operator (such as-number)
Logical operators: Priority once from high to low for not > and > or
There is a picture of the truth:
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M01/88/5D/wKiom1fyRIPw4m1yAAQSx_7ysXQ751.png-wh_500x0-wm_3 -wmp_4-s_2444524886.png "title=" Prioroty.png "alt=" Wkiom1fyripw4m1yaaqsx_7ysxq751.png-wh_50 "/>
This article is from the "Davidlee's Linux Road" blog, so be sure to keep this source http://davidlinux.blog.51cto.com/5965954/1858612
Python Basic Learning Notes (vii)--common operators