Page 116 - ComputerGenius_V2.1_Class8
P. 116

There are various types of Operators used in Python, some of them are listed here:

                  l   Arithmetic Operators
                  l   Assignment Operators

                  l   Comparison Operators























                  Arithmetic Operators

                  Arithmetic  operators  are  used  to  perform  mathematical  operations  like addition,  subtraction,
                  multiplication etc.

                             Operator                              Meaning                           Example

                                 +
                                             Add two operands                                          x + y
                            (Addition)


                                 -
                                             Subtract right operand from the left                       x - y
                           (Subtraction)

                                 *
                                             Multiply two operands                                     x * y
                          (Multiplication)

                                 /           Divide left operand by the right one
                                                                                                        x / y
                             (Division)      (always results into float)


                                 %           Remainder  of the  division  of left  operand  by  the
                                                                                                       x % y
                            (Modulus)        right (remainder of x/y)

                                //           Division that returns the largest integer less than or
                                                                                                       x // y
                          (Floor Division)   equal to the quotient.

                                **           It raises a  number  (the  base)  on  the  left  to  the
                         (Exponentiation/    power  of  another  number  (the  exponent)  on  the      x ** y
                         Power Operator)     right of **.




                       114   Computer Genius (V2.1)-VIII
   111   112   113   114   115   116   117   118   119   120   121