# Python Operators

In this article / tutorial we will learn about Python all basic operators. When we process, calculate and compare values or variables then we use operators. Operators have too much important role in any kind of programming language. Without Operators programming is nothing. Operators make relations between two or more variables and functions. There are many types of Operators you can see below

1. Arithmetic Operators
2. Assignment Operators
3. Comparison Operators
4. Logical Operators
5. Identity Operators
6. membership Operators
7. Bitwise Operators

### 1) Python Arithmetic Operators

Arithmetic operators are used for mathematics or calculations. There are following arithmetic operators in Python

 Operators Names Examples + Addition z+r – Subtraction z-r * Multiplication z*r / Division z/r % Modulus/Remainder z % r ** Exponent z**r

### 2) Python Assignment Operators

Assignment Operators are used for assigning the values to variables. . You can see below the types of Assignment Operators in Python.

 Operators Names Examples Is equal to this = Equal z=9 z=9 += Add Equal z+=9 z=z+9 -= Subtract Equal z-=9 z=z-9 *= Multiply Equal z*=9 z=z*9 /= Divide Equal z/=9 z=z/9 %= Modulus Equal z %= 9 z=z%9 **= Exponent Equal z**=9 z=z**9 //= Floor Equal z//=9 z=z//9 &= And Equal z&=9 z=z&9 |= Or Equal z|=9 z=z|9

### 3)Python Comparison Operators

Comparison operators are used to comparing the values and variables. There are following Types of Comparison Operators

 Operators Names Examples == Equal to z==r != Not Equal to z!=r > Greater Than z>r < Smaller Than z= Greater Than or Equal to z>=r <= Smaller Than or Equal to z<=r

### 4)Python Logical Operators

We use logical operators commonly to combine the two conditional statements of the comparison operators. For example if your age is more than 20 years and less than 22 years. See following the types of the logical operators

 Operators Names Example and Logical AND z>4 and z<9 or Logical OR z<4 or z>9 not Logical NOT not(z<4 and z>9)

### 5)Python Identity Operators

We use Identity Operators to compare the two objects memory locations. See below the Identity Operators

 Operators(syntax) description(use) Example is Return true if both variables are with same objects Z is R is not Return false if both variables are not with same object Z is not R

### 6)Python membership Operators

We use membership operators to check membership/value in a sequence like, lists, strings and tuples. you can see below the membership operators

 Operators(syntax) description(use) Example in Return true if value is present in the object Z in R not in Return false if value is not present in the object Z not in R

### 7)Python Bitwise Operators

We use Bitwise Operators to compare the binary numbers. There are following Bitwise Operators you can see below

 Operators(syntax) Names description(use) & Binary AND Copy a bit if bit exist in both operands | Binary OR Copy a bit if bit exist in at least one operand from two ^ Binary XOR Copy a bit if bit is set in one operand but not in both ~ Binary Open Compliment/NOT It inverts the bits << Binary Left Shift Left Operands Value is shifted left >> Binary Right Shift Left Operands value shifted Right

Get More Python Tutorials