After learning variables and basic Python syntax, I wanted my programs to actually make decisions.
For example, I didn't want Python to just calculate a total. I wanted it to decide whether a customer qualified for free delivery.
That's when operators and conditionals started making sense to me.
Arithmetic operators
Arithmetic operators are used for calculations.
The basic ones are +, -, , /, %, and *.
For example, I can calculate the total cost of a shopping order:
The result is 1000.
The % operator gives the remainder:
print(10 % 3)
The result is 1.
This became useful when I wanted to check things like whether a number was even or odd.
Comparison operators
Comparison operators allow me to compare values.
For example:
age = 20
print(age >= 18)
The result is True.
Python can compare values using operators such as ==, !=, >, <, >=, and <=.
At first, I confused = with ==.
I eventually understood that = assigns a value, while == checks whether two values are equal.
For example:
age = 20
age == 20
The first line stores 20 in age.
The second checks whether age is equal to 20.
Logical operators
Sometimes one condition isn't enough.
That's where and, or, and not come in.
For example, suppose I want to check whether someone can access a system:
Both conditions have to be true for access to be granted.
That's how I started understanding and both conditions must be satisfied.
if, elif and else
This is where things became more interesting for me.
if lets Python check a condition.
elif gives it another condition to check.
else handles everything that doesn't match the earlier conditions.
For example, I can use a student's score:
Since the score is 76, Python prints Pass.
The important thing I understood here is that Python checks the conditions from top to bottom.
A practical example
One of the examples that helped me understand conditionals was a simple shopping system.
I can give customers free delivery when they spend KSh 2,000 or more:
Since the total is 2,500, the customer gets free delivery.
But if:
total = 1500
the result becomes:
Delivery fee: KSh 200
This made conditionals feel much more useful because I could see how they could be used in an actual program.
Combining conditions
I can also create more specific rules.
For example, suppose a customer gets a discount if they spend at least KSh 5,000 and they are a member:
Now Python is checking two things before making a decision.
What I understood
The biggest thing I learnt was that operators are what help Python compare or calculate things, while conditionals use those results to make decisions.
For example:
total = price * quantity
This calculates something.
Then:
if total >= 2000:
uses that result to make a decision.
That connection is what finally made conditionals click for me.
Final thoughts
At first, operators looked like a bunch of symbols I just needed to memorise.
Then conditionals looked like another syntax rule to learn.
But once I started using them together in practical examples, I realised they are really just tools for telling Python:
"Calculate this."
"Compare that."
"If this happens, do this."
"Otherwise, do something else."
That was the point where Python started feeling less like memorising code and more like actually programming.





Top comments (0)