You’ve probably done some basic stuff in Python already—like using print()
or assigning a few variables. Now, you’re ready to do something with those values. Want to add two numbers? Compare two values? That’s where operators come in.
If you’ve ever used a calculator, you already know the basics. But Python operators go beyond just +
and -
. Let’s walk through the ones you’ll use most often—and how they actually work in a real program.
Arithmetic Operators: Your First Tools for Math
Python gives you all the basic math tools, and then some.
Here are the most common ones you’ll use:
+
for addition-
for subtraction*
for multiplication/
for division (returns a decimal)//
for floor division (just the whole number)%
for remainder (modulus)**
for exponent (power)
Let’s say you’ve got:
a = 8
b = 3
Now try:
print(a + b) # 11
print(a % b) # 2
print(a ** b) # 512
One surprise for many beginners is that 10 / 2
gives you 5.0
, not 5
. That’s because /
returns a float—even if there’s no remainder.
Relational Operators: Checking Conditions
These are also called comparison operators. They help Python answer questions like: Is this bigger than that? Are these two values equal?
Here’s a quick reference:
==
is equal to!=
is not equal to>
is greater than<
is less than>=
is greater than or equal to<=
is less than or equal to
Try something like:
x = 5
y = 7
print(x == y) # False
print(x < y) # True
These expressions return True
or False
, which makes them super useful for writing logic with if
statements.
So Why Does This Matter?
Let’s imagine you’re writing a program that checks if a person is eligible to vote.
age = int(input("Enter your age: "))
if age >= 18:
print("You can vote.")
else:
print("Not eligible yet.")
See that >=
That’s a relational operator. Without it, you couldn’t write that condition.
Or maybe you’re working on a billing system. You’ll use arithmetic operators to calculate totals, apply discounts, and determine taxes.
These symbols are small, but they’re doing a lot of heavy lifting in real projects.
Try This Yourself
Here’s a quick mini-project idea.
- Create two variables:
a = 10
,b = 4
- Show the result of every arithmetic operator
- Then, use comparison operators to check things like:
- Is
a
equal tob
? - Is
a
greater thanb
? - Is
a % b
less thanb
?
- Is
Watch the results and see how Python evaluates each one.
Real-World Use Cases
- In a quiz app, you’ll check if the selected answer
==
correct one. - In an e-commerce site, you’ll use
*
and+
to calculate final prices. - In a form, you might validate inputs using
!=
or==
.
Once you know how to use operators, you’re not just writing Python—you’re solving real problems.
Prefer to Watch Instead?
This topic is also covered in our beginner video course. You’ll see the code being written and explained in real time. Perfect if you like to learn visually.
▶️ Watch Operators in Python (Starts around 40:00)
Want to Build Real Skills?
If you’re learning Python to switch careers, build something useful, or just understand how coding works—this is your moment. We’ve built a course just for beginners like you.
👉 Take the Full Python Course (Beginner to Advanced)
Also visit itlearn360.com for free practice material, projects, and more