Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 149 - 2620_Birla Open Mind C-6
P. 149

    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 147

| 144 145 146 147 148 149 150 151 152 153 154 |