Page 12 - Touchcode_C8_Flipbook
P. 12

If any one of the conditions fail, the AND operator returns FALSE.
                          In python AND operator is denoted by ‘and’ keyword.
                          Some other programming languages use ‘&&’ as AND operator.


                  OR Operator
                          It is used to see if either one of two or more conditions are TRUE.
                          If any of the condition is true, the OR operator returns TRUE.

                          If all the conditions false, the OR operator returns FALSE.
                          In python OR operator is denoted by ‘or’ keyword.

                          Some other programming languages use ‘||’ as OR operator.

                  NOT Operator
                          It is used to reverse or negate a condition.

                          If the condition is true, NOT will return false and vice-versa.
                          In python NOT operator is denoted by ‘not’ keyword.

                          Some other programming languages use ‘!’ as NOT operator.

                  RELATIONAL OPERATORS
                  The relational operator checks the value of the two operands.
                  Relational operator returns:

                      1, if the value is true.
                      0, if the value is false.

                  Types of relational operators:

                   Symbol              Operator                             Description                    Example

                   ==          Equal to                      a is equal to b                              (a==b)

                   !=          Not equal to                  a is not equal to b                          (a !=b)
                   >           Greater than                  a is greater than b                          (a > b)

                   <           Less than                     a is less than b                             (a < b)

                   >=          Greater than or equal to      a is greater than or equal to b              (a >=b)
                   <=          Less than or equal to         a is less than or equal to b                 (a <=b)


                                           Coding fact


                         ‘=’ is an assignment operator, used to assign a value to a variable.

                          ‘==’ is a relational (comparison) operator, used to compare the value of two variables.





                   10     Touchcode-VIII
   7   8   9   10   11   12   13   14   15   16   17