Python Operators

Python Operators:

Python Operators are used to perform operations on operands. Operands can be a variable or a constant. The operators are divided into seven groups on the basis of the basic operations they perform.

Arithmetic Operators:

The operators which are used to perform the arithmetical operations, are grouped together as Arithmetic operators.

Operators Symbol
Addition +
Subtraction
Multiplication *
Division /
Modulus
Exponentiation **
Floor Division //

 

Assignment Operators:

The operators which are used to assign values to a variable, are grouped together as Assignment operators.

Operators Symbol
Equals To =
Added Value +=
Subtracted Value -=
Multiplicated Value *=
Divided Value /=
Modulus Value
Exponent and assign **=
Floor division and assign //=

 

Comparison Operators:

The operators which are used to compare two values, are grouped together as Comparison operators.

Operators Symbol
Equal ==
Not equal !=
Greater than >
Less than <
Greater than or equal to >=
Less than or equal to <=

 

Identity Operators:

The operators which are used to compare the same object, with the same memory location, are grouped together as Identity operators.

Operators Symbol
 Identical is
Not Identical is not

 

Logical Operators:

The operators which are used to perform logical operations, are grouped together as Logical operators.

Operators Symbol
AND and
OR or
NOT not

 

Membership Operators:

The operators which are used to check if a sequence is present in an object, are grouped together as Membership operators.

Operators Symbol
Member in
Not a Member not in

 

Bitwise Operators:

The operators which are used to perform Bitwise operations, are grouped together as Bitwise operators.

Operators Symbol
AND &
OR |
XOR ^
NOT ~
Zero fill left shift <<
Signed right shift >>

 

Please follow and like us:
Content Protection by DMCA.com