Page 128 - TechPluse_C7_Flipbook
P. 128
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
() Parenthesis
** Exponent
Multiplication, Division, Modulus,, Floor
*, /, %, //
Relational
+, – Addition, Subtraction
==, !=, >, <, >=, <= Relational
=, +=, -=, *=, /=, %=, **=,
Assignment
//=
and, or, not Logical
SAMPLE PROGRAMS
Program 5: To subtract two numbers entered by the user.
Program 6: To calculate the average marks of three subjects.
Program 7: To calculate the volume and surface area of cylinder.
126 Premium Edition-VII

