Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 114 - 2611_SmartGPT Pro V(5.0) C-6
P. 114

    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
                      are called operands.                                                         Operand      Operator
                         (+) 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.

                       112  Computer Science (V5.0)-VI

| 109 110 111 112 113 114 115 116 117 118 119 |