Page 129 - PortGPT_V2.1_C6_Flipbook
P. 129

(iv)  Assignment Operators

                           ......................................................................................................................................................
                       (v)  Logical Operators

                           ......................................................................................................................................................

                    e.  Distinguish between the following with the help of examples.

                       (i)  AND operator and OR operator
                           ......................................................................................................................................................

                       (ii)  Modulus operator and Division operator

                           ......................................................................................................................................................

                       (iii) Single-line comment and Multiple-line comment
                           ......................................................................................................................................................



                                                                                       fun Zone



                   Let's soLve                                                                         Critical Thinking
                     What will be the output of the following programs?


                    1.  a = 4.5
                       b = 2
                       print(a//b)


                    2.  y = 10
                       y += 2
                       print(y)


                    3.  p, q, r = 10, 20 ,30

                       print(p, q, r)

                    5.  a = 4

                       b = 11

                       print(a or b)
                       print(a > 2)

                    4.  var1 = 1

                       var2 = 2

                       var3 = 3
                       print(var1 + var2 + var3)


                                                                                        Introduction to Programming  127
   124   125   126   127   128   129   130   131   132   133   134