Page 92 - Dig_CodeAI_V2.1_Class_7
P. 92
Precedence of Operators
Precedence of operators determines the order in which the operators are executed. The operator
precedence in Python is listed in the following table. The highest precedence is at the top.
Operator Name
( ) Parentheses
** Exponentiation
*, /, %, // Multiplication, Division, Modulus, Floor Division
+, – Addition, Subtraction
==, !=, >, <, >=, <= Comparison
=, +=, -=, *=, /=, %=, **=, //= Assignment
and, or, not Logical
Arithmetic operators have higher precedence over Relational operators.
Conditional Statements
There are situations in life when we need to decide based on a situation. For example, if it rains, I will
stay at home or else I shall visit the market. Similar situations arise in programming as well, where
we need to make some decisions and based on these decisions, execute a set of commands. Decision
making in Python is done by conditional statements. Conditional statements allow a program to
make decisions and execute specific code blocks based on whether conditions are True or False. The
following conditional statements are available in Python:
if statement
if...else statement
Nested if statement
if…elif…else ladder
Information Literacy
code Quest Technology Literacy
Define the following:
1. Operators Precedence:
2. Arithmetic Operators:
3. Assignment Operators:
90 DigiCode AI (Ver. 2.1)-VII

