In this session , I’ll cover below topics following by some assessments
- Operators Precedence
- IF…ELIF…ELSE Statements
- Nested IF Statements
- Single Statement Suites
1.Operators Precedence
The operator precedence in Python is listed in the following table. It is in descending order (upper group has higher precedence than the lower ones).
| Operators | Meaning |
|---|---|
() | Parentheses |
** | Exponent |
+x, -x, ~x | Unary plus, Unary minus, Bitwise NOT |
*, /, //, % | Multiplication, Division, Floor division, Modulus |
+, - | Addition, Subtraction |
<<, >> | Bitwise shift operators |
& | Bitwise AND |
^ | Bitwise XOR |
| | Bitwise OR |
==, !=, >, >=, <, <=, is, is not, in, not in | Comparisons, Identity, Membership operators |
not | Logical NOT |
and | Logical AND |
or | Logical OR |
2.IF…ELIF…ELSE Statements
An else statement can be combined with an if statement. An else statement contains the block of code that executes if the conditional expression in the if statement resolves to 0 or a FALSE value.
The else statement is an optional statement and there could be at most only one else statement following if and flow chart for this is as follows .
3.Nested IF statements
There may be a situation when you want to check for another condition after a condition resolves to true. In such a situation, you can use the nested if construct.
In a nested if construct, you can have an if…elif…else construct inside another if…elif…else construct.

4.Single Statement Suites
- Suite of an if clause
- A single line if
- Same line if code block