Page 56 - Computer - 7
P. 56

The table given below gives the precedence of operators, from highest to lowest, in Python.

                               Description                                            Operator

           Parentheses                                                         ()

           Exponentiation                                                      **

           Multiplication, Division, Floor division, Modulus                   *, /, //, %
           Addition, Subtraction                                               +, –

           Relational operators                                                >, <, >=, <=, ==, !=

           Assignment operators                                                =, +=, –=, *=, /=
           Logical operators                                                   and, or, not



                   Try This
                                                                                                   Computational Skills
             Evaluate the following expressions and write their result.
             (a) 23 * 20 / 5 + 16 * 4 – 8                              _______________
             (b) (5 ** 3) – (50 * 2) + 40 % 8                          _______________
             (c) (10 + 20 > 15) and (3 * 8 <= 20)                      _______________
             (d) (True or False) and (not(False) and True)             _______________



                 Knowledge Discovery                                                               Subject Enrichment
               The order of precedence of arithmetic operators follows the mathematical rule of BEDMAS. BEDMAS
               stands for Brackets, Exponentiation, Division, Multiplication, Addition, and Subtraction.




                 Database                                                                          Subject Enrichment


               Keywords are the reserved words of a programming language which have their specific meaning and are
               used to frame the statements of a program. Python has a set of keywords which perform specific tasks
               during the program execution. A few keywords in Python are: and, def, for, is, del, from, try, class, except,
               import, pass, elif, not, while, false, true, none, or, continue, in, raise, print, break, else, and if.




          Post-Processing          
                                 
                                 
              Python is an interpreted, object-oriented, high-level programming language for general-purpose
                programming.
              Variables are named locations in the memory of a computer where data is stored temporarily.
              Data type refers to the type of data that is stored in a variable.
              Common data types used in Python are Integer, Float, String, and Boolean.



               54
   51   52   53   54   55   56   57   58   59   60   61