Page 125 - PortGPT_V2.1_C6_Flipbook
P. 125
The result of the above program is:
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, Modulo, Floor Division
+, – Addition, Subtraction
==, !=, >, <, >=, <= Comparison
=, +=, -=, *=, /=, %=, **=, //= Assignment
not Logical
and Logical
or Logical
SOME MORE PROGRAMS
Program 5: To subtract two numbers entered by the user.
Introduction to Programming 123

