Python Progamming/Basics of Python Language

Python Operators

Updated on January 12, 2026
1 min read

Operators in Python

Operators are symbols or keywords used to perform operations on values and variables. They tell Python what action to perform, such as adding numbers, comparing values, or checking conditions. Without operators, a program would not be able to calculate, decide, or manipulate data.

Every Python program uses operators to transform input into meaningful output.

Types of Operators in Python

Python provides several types of operators, each serving a specific purpose.

Arithmetic Operators

These operators are used to perform mathematical calculations.

OperatorMeaning
+Addition
-Subtraction
*Multiplication
/Division
%Modulus (remainder)
**Power
//Floor division

Example:

a = 10
b = 3
print(a + b)
print(a % b)

Comparison (Relational) Operators

These operators compare two values and return either True or False.

OperatorMeaning
==Equal to
!=Not equal
>Greater than
<Less than
>=Greater or equal
<=Less or equal

Example:

x = 10
y = 20
print(x < y)

Logical Operators

These operators are used to combine conditions.

OperatorMeaning
andTrue if both are true
orTrue if at least one is true
notReverses the result

Example:

age = 20
print(age > 18 and age < 30)

Assignment Operators

These operators assign values to variables.

OperatorMeaning
=Assign
+=Add and assign
-=Subtract and assign
*=Multiply and assign

Example:

x = 10
x += 5

Membership Operators

Used to check whether a value exists in a sequence.

OperatorMeaning
inFound in sequence
not inNot found

Example:

fruits = ["apple", "banana"]
print("apple" in fruits)

Identity Operators

Used to compare memory location of objects.

OperatorMeaning
isSame object
is notDifferent object

Example:

a = [1,2]
b = a
print(a is b)

Conclusion

Operators are the tools that make Python useful. They allow programs to calculate, compare, and make decisions. Without operators, Python would only store data—it would never do anything meaningful with it.

Python Operators | Python Progamming | Learn Syntax