Page 133 - TP_Plus_v4_Class6
P. 133

Program 2: To perform all the assignment operators

























                 The output of the above program is:















                 Logical Operators

                 Logical operators are used to combine conditional statements. Python supports the following logical
                 operators:


                 Operator Name Description                                           Example (x=2)             Output
                     and      AND  It returns true, if both expressions are true.    (x < 5) and (x < 10)        True

                      or       OR     It returns true, if one of the expressions is   (x < 5) or (x < 2)         True
                                      true.

                     not      NOT     It reverses the result, returns false, if the   not [(x < 5) and (x < 10)]  False
                                      result is true or vice versa.


                  Program 3: To perform all the logical operators


















                                                                                                          #Python 131
   128   129   130   131   132   133   134   135   136   137   138