Page 20 - Modular v1.1 Pyhton
P. 20

Python divides the operators in the following categories:

                  Arithmetic Operators


                  Arithmetic operators  perform arithmetic operations between  two operands.  The arithmetic
                  operators are defined in the following table:
                                                                                              Example

                   Operator         Name                        Description                   (x=7 and      Output
                                                                                                y=3)
                       +       Addition          Adds values on either side of the
                                                                                                x + y          10
                                                 operator.
                       –       Subtraction       Subtracts right hand operand from left          x – y         4
                                                 hand operand.

                        *      Multiplication    Multiplies values on either side of the         x * y         21
                                                 operator.
                        /      Division          Divides left hand operand by right hand         x / y        2.33

                                                 operand.
                       %       Modulus           Divides left hand operand by right             x % y          1
                                                 hand operand and returns remainder.

                       **      Exponentiation Performs exponential (power)                      x ** y        343
                                                 calculation on operands.
                       //      Floor or Integer  Divides and cuts the fractional part from      x // y         2
                               division          the result.

                  Program 1: To perform the arithmetic operations.



































                   18     Touchpad MODULAR (Version 1.0)
   15   16   17   18   19   20   21   22   23   24   25