Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - What are the common operators in python?
What are the common operators in python?
Arithmetic operator |

+:Add two numbers, add two numbers, or connect strings.

-:Subtract two numbers

*: Multiplies two numbers or returns a string that is repeated many times.

/:When two numbers are divided, the result is a floating-point number.

%: take the modulus and return the remainder of the division of two numbers.

//:Divide two numbers and return the integer part of the quotient.

* *: Power runs and returns the result of power.

Relational operator |

= =: Compare whether the objects are equal.

! =: Compare whether the objects are unequal.

& gt: greater than, for example, a>B will compare the sizes of A and B, A >;; B returns true, otherwise it returns false.

& lt: less than, for example

& gt=: greater than or equal to, for example, a & gt=b, the sizes of A and B will be compared, A >;; =b returns True, otherwise it returns False.

& lt=: For example, less than or equal to.

| Assignment operator |

=: General assignment operator, which assigns the operation result to the variable.

+=: addition assignment operator, for example, a+=b is equivalent to A = A+B.

-=: subtraction assignment operator, for example, a-=b is equivalent to a = a-b.

* =: Multiplication assignment operator, for example, a*=b is equivalent to A = A * B.

/=: division assignment operator, for example, a/=b is equivalent to A = A/B.

//=: divisible assignment operator, for example, a//=b is equivalent to A = A//B/B.

% =: modular assignment operator, for example, a%=b is equivalent to a = a% b.

* * =: Power operation assignment operator, for example, a**=b is equivalent to A = A * B.

Logical operator |

And: and operation, if A is False, A and B return False, otherwise, the calculated value of Y is returned.

Or: OR operation, if a is not 0, the value of a is returned, otherwise the value of b is returned.

Not: not operation, if a is True, it returns False, if a is false, it returns true.

| Member Operator |

In: Returns True if the value is found in the specified sequence, otherwise returns False.

Not in: Returns True if a value is found in the specified sequence, otherwise returns False.

| Identity Operator |

Is: Determine whether two identifiers refer to the same object.

Is not: Determines whether two identifiers refer to different objects.