Sitemap

Operators in python

3 min readFeb 12, 2026

--

Python operators are special symbols or keywords used to perform operations on variables and values. They form the backbone of expressions, conditions, calculations, and logical decisions in Python programs.

Get Saurabh Gandhi’s stories in your inbox

Join Medium for free to get updates from this writer.

This article explains all types of Python operators with clear definitions, syntax, and easy examples, making it ideal for beginners and interview preparation.

What are Operators?

Operators in general are used to perform operations on values and variables. These are standard symbols used for logical and arithmetic operations. In this article, we will look into different types of Python operators.

  • OPERATORS : These are the special symbols. Eg- + , * , /, etc.
  • OPERAND : It is the value on which the operator is applied.

Example:

a = 10
b = 5
print(a + b)

Here, + is an operator that adds two values.

Types of Operators in Python

Python supports the following major types of operators:

  • Arithmetic operators
  • Comparison operators
  • Assignment Operators
  • Logical Operators
  • Bitwise Operators
  • Identity Operators
  • Membership Operators

1. Arithmetic operators

Python Arithmetic operators are used to perform basic mathematical operations like addition, subtraction, multiplication, and division.

Press enter or click to view image in full size

2. Comparison operators

Comparison operators compare two values/variables and return a boolean result: True or False

Press enter or click to view image in full size

3. Logical operators

Logical operators are used to check whether an expression is True or False. They are used in decision-making.

Press enter or click to view image in full size

4. Bitwise operators

Python bitwise operators are used to perform bitwise calculations on integers. The integers are converted into binary format and then operations are performed bit by bit, hence the name bitwise operators. Python bitwise operators work on integers only and the final output is returned in the decimal format. Python bitwise operators are also called binary operators.

5. Identity Operators

Identity operators in Python are used to compare the memory locations of two objects to determine if they refer to the same object.

Press enter or click to view image in full size

6. Membership Operators

Membership operators in Python are used to test whether a value or variable is a member of a sequence (such as a string, list, or tuple).

Press enter or click to view image in full size

Questions

  1. What are operators in Python?
  2. How many types of operators are there in Python?
  3. What is the difference between / and // operators?
  4. What is the difference between == and is
  5. What are logical operators in Python?
  6. What are membership operators?
  7. What are bitwise operators used for?

--

--

Written by Saurabh Gandhi

Python • AI • Tech Learning Writing simple guides that make coding easy for everyone.