Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 141 - 2625 PortGPt V2.1
P. 141

    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  139

| 136 137 138 139 140 141 142 143 144 145 146 |