# Python Operators

Operators in computer languages are used to perform various operations on variables and values. Python operators perform the same task in the python language. Below is a very simple program in python to understand the basic function of the operator.

``print(10 + 10);``

### Output

``20``

This statement in python is making use of the ‘+’ operator. This operator is helping the user directly perform the addition of two numbers.

## Python Operators Types

• Arithmetic operators
• Assignment operators
• Comparison operators
• Logical operators
• Identity operators
• Membership operators
• Bitwise operators
• Python Modulo operator

### Airthematic Operators

Arithmetic operators are used with numeric values to perform common mathematical operations like addition, subtraction, multiplication, division, etc. Some of them are described below:

### Assignment Operators

Assignment operators are used to assign values to variables. Some of them are described below:

### Comparison Operators

Comparison operators in python are used to perform comparisons between two values. Some of them are described below:

### Logical Operators

Logical operators are used to combine conditional statements. Some of them are described below:

### Identity Operators

Identity operators are used for comparing the objects in python, not if they are equal, but if they are actually the same object, with the same memory location. Some of them are described below:

### Membership Operators

Membership operators are used for testing if a sequence is presented in an object. Some of them are described below:

### Bitwise Operators

Bitwise operators are used for comparing binary numbers in python. Some of them are described below:

### Python Modulo Operator

We denote the Python Modulo operator as %. We can also call it a Modulus Operator. Python Modulo is a mathematical operation and we can use it for calculating remainder. Basically, this module is used to get the remainder of a division problem. This modulo operator is a type of arithmetic operator.

## Operator Precedence and Associativity

The precedence and associativity of operators in python determine the priorities of the operator. Mainly, precedence is used in an expression with more than one operator with different precedence to determine which operation to perform first. However, if an expression contains two or more operators with the same precedence then Operator Associativity is used to determine. It can either be Left to Right or from Right to Left.

Operator Overloading in python is a term for giving extended meaning beyond their pre-defined meaning. For example operator, ‘+’ is used to perform addition between two integers as well as join two strings and merge two lists. It is achievable because the ‘+’ operator is overloaded by int class and str class in python. The learner might have noticed that the same built-in operator or function shows different behavior for objects of different classes, this is called Operator Overloading.

``````print(10 + 10)

print("Developer"+"Helps")

print(10 * 10)

print("Developer"*2)``````

### Output

``````20
DeveloperHelps
100
DeveloperDeveloper
>``````