IFIAG
Since October 2026, two tracks, two levels, 40 sessions written in advance.
- Format
- In class, at the institution
- Sector
- Private higher education

By Abdellah El Ghazi, Python instructor and founder of TeamElGhaziPublished on November 12, 2026
Don't guess. Run the code.At a glanceWith z = 1 > 8 followed by print(z), Python prints False: 1 is not greater than 8, and that result is stored in z. This article explains what Python does line by line, the six comparison operators, the difference between = and ==, and offers three solved exercises. It is written for middle schoolers, high schoolers, college students and anyone just starting out. All the code was run with Python 3.
The article at a glance
Short answer: False. The comparison 1 > 8 asks a question: "Is 1 greater than 8?" The answer is no. Python stores that no, written False, in the variable z, and then print(z) displays it.
If the exercise is written z = 8 > 1, the answer becomes True. So always check which way the code is written.
z = 1 > 8
print(z)
# Output:
# False
The question looks simple. Yet it tests three notions at once: the order in which Python reads a line, the Boolean type, and the difference between storing a value and comparing two values.
Python has six. Each one can only answer True or False.
The most commonly mixed up are >= and <=. 3 >= 3 is true, because "greater than or equal to" accepts equality. 3 > 3 is false.
Many students come across this exercise in a prompt written in Arabic. Arabic is written right to left, code left to right: when a line mixes the two, the screen reorders the display (Unicode's bidirectional rule), and the > sign may be drawn flipped, like a <.
The comparison itself keeps its meaning: the sign flips along with the order of the numbers. The right reflex: Python code is read left to right, with the variable before the = sign. If in doubt, retype the line in an editor and run it.
A single = stores a value in a variable. A double == compares two values and answers True or False. In a condition, you therefore need ==.
Here is Python's actual message when you get it wrong. It even suggests the fix itself. Reading an error message all the way through is a habit to build from the first session.
x = 5
if x = 5:
print('ok')
# Output:
# SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
Once you understand the six operators, you can chain and combine them.
grade = 14
print(10 <= grade < 20) # True
print(1 > 8 and 8 > 1) # False
print(1 > 8 or 8 > 1) # True
print(not (1 > 8)) # True
print('10' == 10) # False
print(True + True) # 2
Work out the answer before running the code.
Operators, conditions and loops open the program of our Python Fundamentals course: one and a half months, online and live, with an automation project at the end. It welcomes all beginners: high schoolers, college students, employees, people changing careers.
Python is also one of the courses we teach at IFIAG, in Casablanca, since October 2026.
z = 1 > 8print(z)print(type(z))
$ python3 comparaison.py✓ False✓ <class 'bool'>
Since October 2026, two tracks, two levels, 40 sessions written in advance.
A program that does a task for you.
5 answers
False. The > operator asks whether 1 is strictly greater than 8. The answer is no, so Python returns the Boolean False. Conversely, print(8 > 1) prints True.
They are the only two values of the bool type, and Python writes them that way. In lowercase, true is not recognized: Python answers NameError: name 'true' is not defined.
With ==, yes, but the answer is False: '10' == 10 gives False. With >, <, >= or <=, Python refuses and answers TypeError. First convert the text to a number with int().
To make decisions. An if condition runs a block only if the comparison equals True. A while loop keeps going as long as the comparison equals True.
Start with Python Fundamentals, TeamElGhazi's entry-level course: one and a half months, online and live, no prerequisites. Operators and conditions are in the first module.
No question matches. Write to us: we answer everything.
Individuals, institutions, companies: you choose your slot online. A first 30-minute conversation about a project, or your hours of lessons.
Choose a slot