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
   120   121   122   123   124   125   126   127   128   129   130