Page 114 - Plus_V2.2_C6_Flipbook
P. 114

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
                             and, or, not                  Logical
                  Example of precedence:
























                           SOME MORE PROGRAMS



                   Program 5: To subtract two numbers entered by the user.













                   Program 6: To calculate the average marks of three subjects.














                  112   Premium Edition-VI
   109   110   111   112   113   114   115   116   117   118   119