Page 27 - Modular v1.1 Pyhton
P. 27

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























                    Recap


                          A data type specifies the type of value a variable can contains.
                          Comments enable us to understand the way a program works.
                           Operators can be defined as special symbols which perform arithmetic and logical computation.
                          Arithmetic operators perform arithmetic operations between two operands.
                          Assignment operators are used to assign the value of the right expression to the left operand.
                           Relational operators are used to compare the value of the two operands and returns True or
                          False accordingly.
                          Precedence of operators determines the order in which the operators are executed.






                                                        Exercise


                 A.  Tick ( ) the correct option.

                     1.    What will be the output of the following expression?
                          22 % 3

                          a.   7                                        b.   1
                          c.   0                                        d.    5

                     2.   The statement using AND operator results true if …………………… .

                          a.   Both operands are true                   b.   Both operands are false
                          c.   Either of the operands are true          d.   Neither of the operands is true

                     3.   Which one of the following has the highest precedence in a logical expression?
                          a.   Addition                                 b.   Multiplication

                          c.   Exponential                              d.   Parentheses





                                                                            Data Types and Operators in Python    25
   22   23   24   25   26   27   28   29   30   31   32