# Python Operators Tutorial In this article, you will learn about Python operators as well as you will learn different types of operators in Python using appropriate examples. In previous we have seen all about Python comments and its usages. Any programming languages, Operators play a major role using Operators we can perform different types of operations.
In Python, operators are used to performing a specific task using variables and values.

Before going through this tutorial, Let’s understand what is operators in Python?

## What is Python operators ?

In Python, the operator is a symbol which performs a specific task using variable and values. The value that the operator operates is called an operand.

Example

``````x = 12
y = 23
print(x + y)``````

In the above example + is the operator that performs addition. 12 and 23 is the operand in this example and + is the operator.

In Python, There are different types of operators available:

## Types of Python Operators

• Arithmetic Operator
• Assignment Operator
• Comparison Operator
• Logical Operator
• Identity Operator
• Membership Operator
• Bitwise Operator

### Python Arithmetic Operators:

In Python, Arithmetic Operators are used to performing Mathematical operations like addition, division, multiplication, and subtraction.

Example

``````x = 18
y = 5

print('x + y:- ', x + y)
print('x -y:- ', x - y)
print('x * y:- ', x * y)
print('x / y:- ', x / y)
print('x % y:- ', x % y)
print('x // y:- ', x // y)
print('x ** y:- ', x ** y)``````

Output

``````x + y:-  23
x -y:-  13
x * y:-  90
x / y:-  3.6
x % y:-  3
x // y:-  3
x ** y:-  1889568``````

### Python Assignment Operator:

In Python, the assignment operator is used to assign the value to variables.

### Comparison Operator:

Python Comparison operators are used to compare one operand to another operand.

Examples

``````x = 25
y = 19

print(x > y)
print(x < y)
print(x != y)
print(x <= y)
print(x >= y)
print(x == y)``````

Output

``````True
False
True
False
True
False``````

### Logical Operators in Python:

In Python, Logical operators are used to combine conditional statements.

Examples

``````x = 12
print(x < 20 or x < 3)
print(x < 30 and x  > 4)
print(not(x  < 30 and x > 4))``````

Output

``````True
True
False``````

### Python Identity Operators:

is and is not are the identity operators in Python. They are used to check if two values (or variables) are located on the same part of the memory. Two variables that are equal do not imply that they are identical.

Example

``````x1 = 23
y1 = 23

x2 = 'Python'
y2 = 'Python'

x3 = [1,2,3]
y3 = [1,2,3]

print(x1 is y1)
print(x2 is not y2)
print(x3 is y3)``````

Output

``````True
False
False``````

### Python Membership Operator:

Membership operators `is `used to check if a sequence present in the object.

Examples

``````x = 'Programming Funda'

print('P' in x)
print('Funda' not in x)``````

Output

``````True
False``````

### Python Bitwise Operator

Bitwise operators are used to compare binary numbers.

## Conclusion

So, In this article, you have learned what is Python operators and Python operators types and usages. In Python, Operators are used to perform any particular task for example addition, division, comparison, and so many more operations can perform by operators.

I hope this tutorial will have helped you. If you like this Python operators tutorial, if you have any doubt regarding Python operators, Then you can comment. if you like this Python operators tutorial, Please share it with your friends who want to learn Python from scratch to advanced.