Page 29 - tp_Modula_v2.0
P. 29

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

                     Output

                  Enter the height of cylinder:5
                  Enter the radius of cylinder:10
                  The volume of the cylinder is: 1571.4285714285713
                  Surface area of the cylinder is: 942.8571428571429









                    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    27
   24   25   26   27   28   29   30   31   32   33   34