KwickAcademy Python · 9 min · free
Python Operators, Precedence and Expression Evaluation
Learn Python operators: arithmetic, relational, logical, assignment, identity and membership, plus precedence step by step. Precedence is the order in which Python solves operators in one expression; brackets come first.
Follows the syllabus of: CBSE Class 11 Computer Science (083)
On screen in this lesson
Operators and operands
| Operator: a symbol that does a job, like + |
| Operand: the value it works on |
| Expression: operators and operands together |
| In 7 + 2, + is the operator; 7 and 2 are operands |
Arithmetic operators
| Operator | Name | 17 and 5 gives |
|---|---|---|
| + - | add, subtract | 22, 12 |
| * | multiply | 85 |
| / | divide | 3.4 |
| // | floor division | 3 |
| % | modulus | 2 |
| ** | exponent (power) | 1419857 |
Relational operators
| Operator | Asks | Example |
|---|---|---|
| == | equal to? | 5 == 5 is True |
| != | not equal to? | 5 != 5 is False |
| > and < | greater, less? | 8 > 3 is True |
| >= and <= | or equal to? | 3 >= 3 is True |
Logical operators
| Operator | True when | Example |
|---|---|---|
| and | both are True | 5 > 3 and 2 > 1 |
| or | at least one True | 5 > 9 or 2 > 1 |
| not | flips the value | not False |
Assignment operators
| Operator | Same as | If runs is 10 |
|---|---|---|
| = | stores a value | runs = 10 |
| += | runs = runs + 4 | 14 |
| -= | runs = runs - 4 | 6 |
| *= | runs = runs * 4 | 40 |
| //= %= **= /= | same pattern | 2, 2, 10000, 2.5 |
Identity and membership
| == checks: are the values equal? |
| is checks: is it the very same object? |
| in checks: is the item inside? |
| is not and not in give the opposite |
Quick answers
Is 10 + 3 * 2 equal to 26 or 16?
16, because multiply comes before add. (10 + 3) * 2 gives 26.
What is 2 ** 3 ** 2?
512, because ** goes right to left.
KwickClips from this lesson
Short clips, one idea each. Good for revision the night before.
What does % give?44 sec
Why no ZeroDivisionError?42 sec
Does Python have ++?44 sec
What does is check?44 sec
What is 10 + 3 * 2?44 secThe full lesson, in text
Hello students, welcome to Kwickprep. What is ten plus three into two? Is it twenty six or sixteen? Python has fixed rules to decide. Today we learn every group of operators, and the order Python follows in a long expression.
First, three terms. An operator is a symbol or word that does a job, like the plus sign. An operand is a value the operator works on. An expression is a mix of operators and operands that Python calculates into one value. In seven plus two, plus is the operator, and seven and two are the operands.
Arithmetic operators do maths, and we will use seventeen and five. Plus and minus add and subtract, giving twenty two and twelve. The star multiplies, and we often read it as into, giving eighty five. A single slash divides and always gives a float, three point four. Double slash is floor division, which keeps only the whole number part, three. The percent sign is modulus, which gives the remainder, two. Double star is the exponent, so seventeen to the power five.
Let us use floor division and modulus in real life. Seventeen laddoos are shared equally among five kids. Floor division tells us each kid gets three laddoos. Modulus tells us two laddoos are left over. And two to the power ten is one thousand twenty four.
Now a trap. Floor division always rounds down, towards the smaller number. Minus seventeen divided by five is minus three point four. Rounding down gives minus four, not minus three. Then the remainder must be three, because minus four times five, plus three, is minus seventeen.
Relational operators compare two values, and the answer is always True or False. Double equals asks, are they equal? Exclamation equals asks, are they not equal? Greater than and less than ask which one is bigger or smaller. Greater than or equal to, and less than or equal to, also say True when the values are equal. Remember, one equals sign stores a value, and two equals signs compare.
Logical operators join or flip conditions. The and operator gives True only when both sides are True. The or operator gives True when at least one side is True. The not operator flips the value, so not False gives True.
Can this student drive a car? Age is sixteen, and has licence is False. Age at least eighteen, and has licence, is False, because both parts are False. With or, age equal to sixteen is True, so the whole answer is True. And not has licence flips False into True.
Python stops checking and, or, as soon as the answer is certain. This is called short circuit evaluation. With and, if the left side is False, the right side is skipped. Here balance is zero, so the left side is False. Dividing by zero would crash with a zero division error, but Python never reaches it. With or, a True left side skips the right side.
Assignment operators store values in variables. The single equals sign stores a value. Augmented assignment does maths and stores in one step, so plus equals four adds four. Minus equals four subtracts four. Star equals four multiplies by four. Floor divide, modulus, power and divide follow the same pattern.
Let us track a score with augmented assignment. The score starts at zero. A four makes it four, and a six makes it ten. Then one run is taken away, so it is nine. Finally star equals two doubles it, so the output is eighteen. Python has no plus plus operator, so write plus equals one to add one.
Now two special groups. Double equals is equality, and it checks whether two values are equal. The is operator is identity, and it checks whether two names point to the very same object in memory. The in operator is membership, and it checks whether an item is inside a list or a string. Is not and not in give the opposite answers.
Two school bags hold the same things, a pen and a book. A list is a collection of items inside square brackets. Bag one double equals bag two is True, because the contents are equal. But bag one is bag two is False, because they are two separate lists. Bag three was made to point at bag one, so bag one is bag three is True. Use is mainly to check for None.
Here is a canteen menu with idli, dosa and vada. Dosa in menu is True. Poha not in menu is also True, because poha is missing. The in operator works on strings too, and cat is inside education, so True.
Precedence is the order in which Python solves operators in one expression. Brackets come first, always. Next comes the exponent, double star. Then multiply, divide, floor division and modulus, on one level. Then add and subtract. Then all comparisons, including is and in. Last come logical operators: not, then and, then or. Same level operators go left to right, except double star, which goes right to left.
Let us solve ten plus three into two to the power two, floor divided by four, minus one. Step one, the exponent. Two to the power two is four. Step two, star and double slash are on the same level, so go left to right: three into four is twelve. Step three, twelve floor divided by four is three. Step four, plus and minus go left to right, so ten plus three is thirteen. Step five, thirteen minus one gives the final answer, twelve.
Python agrees, the first answer is twelve. Now our opening question. Ten plus three into two gives sixteen, because multiply comes before add. Brackets change the order, so ten plus three, in brackets, into two gives twenty six. When in doubt, add brackets.
Pause and predict. Is two double star three double star two equal to sixty four? No! Double star goes right to left, so three to the power two is nine first. Two to the power nine is five hundred twelve. Minus two double star two gives minus four, because the power is done before the minus sign. In the last line, comparisons give True and not True. Not comes before and, so True and False is False.
Some exams use pseudocode with different symbols. The left arrow assigns a value. Mod gives the remainder, like the percent sign, and div gives the whole number part, like double slash. The two angle brackets together mean not equal to. And, or and not are written in capital letters.
Let us revise what we learned today. Double slash keeps the whole number part, and percent gives the remainder. And and or stop early, which is short circuit evaluation. Plus equals and similar operators calculate and store in one step. Double equals checks equal values, is checks the same object, and in checks membership. The order is brackets, exponent, multiply and divide, add and subtract, comparisons, and then logical operators.
Courses that teach this
| Course | Unit |
|---|---|
| CBSE Class 9 Information Technology (402) | Electronic Spreadsheet |
| CBSE Class 9 Artificial Intelligence (417) | Part B - Unit 5: Introduction to Python |
| CBSE Class 11 Computer Science (083) | Computational Thinking and Programming - I |
| CBSE Class 11 Computer Science Essentials (083) | Computational Thinking and Programming - I |
| CBSE Class 11 Informatics Practices (065) | Introduction to Python |
| CBSE Class 11 Artificial Intelligence (843) | Python Programming |
| ICSE Class 9 Computer Applications | Values and Data Types |
| ISC Class 12 Computer Science (868) | Variables and Expressions |
| GSEB Std 12 Computer Studies | Cascading Style Sheets and JavaScript |
| Cambridge IGCSE Grade 10 Computer Science (0478) | 8. Programming |
| NIOS Senior Secondary Data Entry Operations (336) | Lesson 8: Formulas, Functions and Charts |
| Programming All levels Python | Variables, Data Types and Operators |
Voice-over in this lesson is AI-generated. The script is written and checked by Kajal Ma'am. Boards can revise a syllabus mid-year, so confirm anything you plan around against the official board circular. Keep your passwords, OTPs and ID numbers to yourself — we never ask for them. To reach Kajal Ma'am, use the WhatsApp button; sharing your number there is how we call you back.
Free to watch, no sign-up. Live classes with Kajal Ma'am are the paid course; these lessons stay free either way.

