Python Operator

Operators are the constructs which can manipulate the value of operands.

Consider the expression 4 + 5 = 9. Here, 4 and 5 are called operands and + is called operator.

operator-operand
operator-operand

Types of Operator

Python language supports the following types of operators.

  • Python Arithmetic Operators

Assume variable a holds 10 and variable b holds 20, then

arithmetics operation
arithmetics operation
  • Python Comparison Operators

These operators compare the values on either sides of them and decide the relation among them. They are also called Relational operators.

Assume variable a holds 10 and variable b holds 20, then

Comparison operators
Comparison operators
  • Python Assignment Operators

Assume variable a holds 10 and variable b holds 20, then

Assignment Operators python
Assignment Operators python
  • Python Bitwise Operators

Bitwise operator works on bits and performs bit by bit operation. Assume if a = 60; and b = 13; Now in binary format they will be as follows −

a = 0011 1100

b = 0000 1101

—————–

a&b = 0000 1100

a|b = 0011 1101

a^b = 0011 0001

~a  = 1100 0011

There are following Bitwise operators supported by Python language

 

bitwise operator pytohn
bitwise operator pytohn

Web Hosting

  • Python Logical Operators

There are following logical operators supported by Python language.

Assume variable a holds 10 and variable b holds 20, then

python logical operator
python logical operator
  • Python Membership Operators

Python’s membership operators test for membership in a sequence, such as strings, lists, or tuples. There are two membership operators as explained below

member operator python
member operator python
  • Python Identity Operators

Identity operators compare the memory locations of two objects. There are two Identity operators explained below:

identity operator python
identity operator python

 

Satya Prakash

VOIP Expert: More than 8 years of experience in Asterisk Development and Call Center operation Management. Unique Combination of Skill Set as IT, Analytics and operation management.

One thought on “Python Operator

  • February 10, 2016 at 2:46 am
    Permalink

    If you are going for finest contents like I do, just pay a
    quick visit this web page everyday because it provides feature contents, thanks

Leave a Reply