Page 87 - Digicode_AI_class_7
P. 87

print("Rachna")                               Akshat
              print("Sambhav")                              Tushar

              print("Akshat")
              print("Tushar")

            However, the text written inside triple quotes (''' or ''"") is also considered as comment. You can use
            the triple quotes to write multiline comments. For example:

                             '''This is                         """This is
                                Multiline            OR            Multiline
                                Comment'''                         Comment"""

            Operators
            In  Python,  operators  can  be  defined  as  special  symbols  which  perform  arithmetic  and  logical
            computation.  The  values which  the  operators  use  to  get the  output  are  called  operands.
            For example, in the expression 10 – 5, 10 and 5 are operands and the minus (–) sign is the operator.

            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)
                                                                                                         10
                 +       Addition          Adds values on either side of the operator.     x + y
                                                                                                         4
                 –       Subtraction       Subtracts  right  hand  operand  from  left     x – y
                                           hand operand.
                                                                                                         21
                 *       Multiplication    Multiplies  values  on  either  side  of  the   x * y
                                           operator.
                                                                                                         3
                 /       Division          Divides  left  hand  operand  by  right  hand   x / y
                                           operand.
                                                                                                         1
                 %       Modulus           Divides  left  hand  operand  by  right  hand   x % y
                                           operand and returns remainder.
                                                                                                        343
                 **      Exponentiation    Performs exponential (power) calculation       x ** y
                                           on operands.
                                                                                                         2
                 //      Floor or Integer  Divides and cuts the fractional part from      x // y
                         division          the result.








                                                                                       More on Python     85
   82   83   84   85   86   87   88   89   90   91   92