Page 99 - Information_Practice_Fliipbook_Class11
P. 99

= 270+3/ 5
               = 270+0.6

               = 270.6
            (ii)  45*(6+3)/5

               Solution:
               = 45*(9)/5        …… expression within the () will be evaluated first

               = 405/5
               = 81.0
            (iii) 4 >= 5*3//4

               Solution:
               = 4 >= 15//4      ………. * is evaluated

               = 4 >= 3          ………. // is evaluated
               = True            ………. >= 3 is evaluated

            (iv) True and False or not True
               Solution:
               = True and False or not True
               = False or False
               = False



                     Name the operator:
                     1.  It yields True if any of the two operands evaluates as  True and False otherwise.
                     2.  It performs modulus and assignment.
                     3.  It checks whether x is equal to 5.
                     4.  It divides two numbers and yields the quotient as a float.
                     5.  It assigns a value to a variable.
                     6.  It evaluates to False if the operands on either side of the operator denote the same data type.
                     7.  Binary operator with highest precedence



            4.7 Type conversion

            Type conversion is the process of converting the value of one data type to another. This is done when an expression
            is formed using data of multiple data types. Type conversion can be achieved in two ways – explicitly and implicitly.

            4.7.1 Implicit Type Conversion

            Implicit type conversion, also known as coercion, takes place when a data value is converted from one data type
            to another by the Python interpreter without explicit type conversion by the programmer. Consider the following
            example:

             >>> num = 20
             >>> num1 = 15.5
             >>> sum = num + num1    # int object num is converted to float implicitly.
             >>> print(sum)
                     35.5
             >>> type(sum)
                 <class 'float'>

                                                                                        Data Types and Operators  85
   94   95   96   97   98   99   100   101   102   103   104