Page 43 - 2501_KVS_C-8
P. 43

Activity 3.1


                   A.  Answer the following questions:
                        1.  What do you mean by the logic of a problem or a program?

                            _________________________________________________________

                        2.  What is a logical operator?

                            _________________________________________________________
                        3.  Write the function of ‘not’ logical operator in python.

                            _________________________________________________________
                        4.  What is the difference between ‘and’ & ‘or’ logical operator?


                            _________________________________________________________
                   B. Fill in the Blanks.

                        1.   ___________ is a unary logical operator that works on a single condition.
                        2.  In the statement (3>5) and (4<=8), ‘and’ is a ___________ operator.

                        3.  In the statement (3>5) and (4<=8), ‘<=’ is a ___________ operator.

                        4.  ___________  logical  operator  gives  the  final  output  ‘True’  even  a  single
                            condition is ‘True’.

                        5.   ‘and’ or ‘or’ logical operators are used when ___________ or more conditions
                            are to be checked.
                   C.  Predict/Select the correct OUTPUT for each question.

                        1.  !(4>10):

                         A.    True                                 C.   Error
                         B.    False                                D.   None

                        2.  not (5<3):

                         A.    True                                 C.   Error
                         B.    False                                D.   None
                        3.  (5>3) and (8<12):


                         A.    True                                 C.   Error
                         B.    False                                D.   None
                        4.  (8<2) or (2<=9):


                         A.    True                                 C.   Error
                         B.    False                                D.   None



                                                                     Logical Operators in Python                    41
   38   39   40   41   42   43   44   45   46   47   48