Page 25 - Modular v1.1 Pyhton
P. 25

On running the above program, you will get the following output:
























                     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 Division

                        +, –                              Addition, Subtraction

                        ==, !=, >, <, >=, <=              Relational
                        =, +=, -=, *=, /=, %=, **=, //=   Assignment

                        and, or, not                      Logical

                        Clickipedia




                         Arithmetic operators have higher precedence over Relational operators.



                     SOME MORE PROGRAMS



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













                                                                            Data Types and Operators in Python    23
   20   21   22   23   24   25   26   27   28   29   30