Operators are special symbols or keywords used in Python to perform operations on values and variables. The values on which an operator performs an operation are called operands.
For example:
a + b
Here, + is the operator, while a and b are the operands. Python evaluates the expression by applying the operation represented by the operator to its operands.
1. Understanding Operators and Operands
An operator tells Python what operation to perform, while operands provide the data on which the operation is performed.
Consider:
10 + 20
Here:
10 is the first operand.
+ is the operator.
20 is the second operand.
- The result of the expression is
30.

2. Operators Work with Different Numbers of Operands
Depending on the operator, an operation may require one, two, or more operands.
Unary Operator
A unary operator works with a single operand.
-x
Here, - is a unary operator and x is its operand.
Binary Operator
A binary operator works with two operands.
a + b
Here, a and b are the two operands.
Some Python operations can also involve more than two values through a sequence of operations or expressions.
3. Common Categories of Operators
Python provides several categories of operators, each designed for a particular purpose.
| Category |
Purpose |
Examples |
| Arithmetic |
Perform mathematical calculations |
+, -, *, /, //, %, ** |
| Assignment |
Assign or update values |
=, +=, -=, *= |
| Comparison |
Compare values |
==, !=, >, <, >=, <= |
| Logical |
Combine or modify conditions |
and, or, not |
| Identity |
Check whether objects are the same object |
is, is not |
| Membership |
Check whether a value belongs to a collection |
in, not in |
| Bitwise |
Perform operations on individual bits |
&, ` |
, ^, ~, <<, >>` |

4. Operators Form Expressions
An operator and its operands together form an expression.
For example:
a + b * 2
This expression contains variables, a constant, and arithmetic operators. Python evaluates the expression according to the rules of operator precedence and associativity.
The result of an expression can be assigned to a variable:
total = a + b
Here, the expression a + b is evaluated first, and its result is assigned to total.
5. Operators Can Produce Different Types of Results
The result produced by an operator depends on the operands and the operator being used.
For example:
10 + 5
produces a numeric result, while:
10 > 5
produces a Boolean result:
True
Similarly:
"Hello" + " Python"
joins two strings and produces another string.
Thus, operators do not simply perform calculations; they can also compare, combine, test, or manipulate values.
6. The Same Symbol Can Have Different Meanings
The meaning of an operator can depend on the types of its operands.
For example:
10 + 20
performs numerical addition, whereas:
"Hello" + " World"
joins two strings.
The + operator therefore performs an operation appropriate to the types of its operands.
This ability is an important feature of Python and is closely related to the way Python objects define their behaviour.
7. Operators and Variables
Operators are frequently used with variables to build useful expressions.
price = 500
quantity = 3
amount = price * quantity
Here, price and quantity are operands of the * operator. The resulting value is stored in amount.
In a real program, operators allow us to transform input data into useful results.
8. Operators and Conditions
Comparison and logical operators are particularly important when a program needs to make decisions.
For example:
marks >= 40
checks whether the value of marks is at least 40.
Multiple conditions can be combined:
marks >= 40 and attendance >= 75
Here, the comparison expressions act as operands of the logical and operator.
The result is a Boolean value, either True or False.
9. Operator Precedence
When an expression contains multiple operators, Python needs rules to determine the order in which they are evaluated.
For example:
10 + 5 * 2
The multiplication is performed before the addition, so the result is 20.
Parentheses can be used when we want to explicitly control the order:
(10 + 5) * 2
This produces 30.
Understanding operator precedence is therefore important for writing expressions that produce the intended result.
10. Key Takeaways
- An operator specifies an operation to be performed.
- An operand is a value or expression on which an operator operates.
- Unary operators require one operand, while binary operators normally require two.
- Operators are used for arithmetic, assignment, comparison, logical operations, identity, membership, and bitwise operations.
- The same operator can behave differently depending on the types of its operands.
- Operators and operands combine to form expressions.
- Operator precedence determines the order in which parts of an expression are evaluated.
- Understanding operators and operands is essential for writing meaningful Python expressions and programs.