Python Operator

Python support operators same as c and c++ operators like arithmetic operators,logical operators and more operators same as c and cpp the following all type of operators are describe into details.

Types of Python Operators

     Arithmetic Operators  

     Relational Operators  

     Assignment Operators  

     Logical Operators  

     Membership Operators  

     Identity Operators  

     Bitwise Operators  


Arithmetic Operators


Operators

Description

+

Addition

-

Subtraction

*

Multiplication

/

Division

%

Modulus

**

Raise to Power

//

Floor Division


Relational Operators


Operators

Description

<

Less Than

>

Greater Than

<=

Less Than or Equal to

>=

Greater Than or Equal to

==

Equal to

!=

Not Equal to

<>

Not Equal to


Assignment Operators


Operators

Description

=

Assignment

/=

Divide and Assign

+=

Addition and Assign

-=

*=

Multiply and Assign

%=

Modulus and Assign

**=

Exponent and Assign

//=

Floor Division and Assign


Logical Operators


Operators

Description

and

Logical AND

or

logical OR

not

logical NOT


Membership Operators


Operators

Description

in

Returns true if a variable is in sequence of another variable, else false.

not in

Returns true if a variable is not in sequence of another variable, else false


Identity Operators


Operators

Description

is

Returns true if identity of two operands are same, else false

is not

Returns true if identity of two operands are not same, else false.


Bitwise Operators


Operators

Description

&

Binary AND

|

Binary OR

^

Binary XOR

~

Binary Ones Complement

<<

Binary Left Shift

>>

Binary Right Shift

Share Share on Facebook Share on Twitter Share on Google+ Share on LinkedIn Pin on Pinterest Share on Stumbleupon Share on Tumblr Share on Reddit Share on Diggit