Python study notes: operator

Logical Operators:

+ Plus

- Less

* Multiplication

/ Division

% Modulus - Returns the remainder of division

** power - returns x power of y

// divisible

 

Comparison operators:

== equal - compare objects for equality

! = Not equal to - compare whether two objects are equal

<> Not equal to - in the presence of the python2, python3 been canceled

> Greater than

<Less than

 

Assignment operator:

= C = a + b a + b the result is assigned to c

+ = C + = a is equivalent to the equation c = c + a

- = c- = a is equivalent to the equation c = ca

* = C * = a is equivalent to c = c * a

/ = C / = a is equivalent to c = c / a

% = C% a equivalent to c = c% a

** = c ** = a is equivalent to c = c ** a

// = c // = a is equivalent to c = c // a

 

logic operation:

and the Boolean "and" - if x is False, x and y returns False, else it returns evaluation of y

or Boolean "or" - If x is True, it returns the value True, otherwise it returns evaluation of y

not Boolean "NOT" - If x is True, it returns False. If x is False, it returns True

Guess you like

Origin www.cnblogs.com/leiyu567567/p/11276400.html