Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 84 - 2606_PlugGPT_C6_Flipbook
P. 84

    Example:

                      Program: #printing a string
                      print("Hello TrackPad")
                      Output: Hello TrackPad

                      Multiple-line Comment
                      Python does not have a syntax for multiline comments. To add a multiple-line comment, you
                      could insert a # for each line. Example:

                      Program: #print three names
                      print("Roli")

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

                      '''
                      This is a multiple-line comment that spans two lines in Python.

                      '''

                                               Write 'T' for True and 'F' for false.

                                               1.  Variables are memory reference points where we store values.
                              uiz    Bee       2.  An Integer is a collection of one or more characters put in single

                                                 or double-quotes.

                                OPERATORS IN PYTHON

                      Operators  are the special  symbols that  are used  to  perform                  20 + 10
                      computations. The values which the operators use to get the output           Operand      Operator
                      are called operands.

                         (+) Addition operator: It is an arithmetic operator which is used to perform addition. Arithmetic
                        operators  perform arithmetic  operations  between  two  operands.  Some  more  arithmetic
                        operators are:
                         (–) Subtraction operator: It subtracts the right-hand operand from the left-hand operand.
                         (*) Multiplication operator: It multiplies values on either side of the operator.
                         (/) Division operator: It divides the left-hand operand by the right-hand operand.
                          (%) Modulus operator: It divides the left-hand operand by the right-hand operand and returns
                        the remainder.

                         (**) Exponentiation operator: It performs exponential (power) calculation on operands.
                         (//) Floor or Integer division operator: It divides and cuts the fractional part from the result.

                       82   Premium Edition-VI

| 79 80 81 82 83 84 85 86 87 88 89 |