Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 100 - 2607_Trackpad_Pro_5.1_flipbook_C6
P. 100

    Comments are not a part of the program, but they do enhance the interactivity of the program
                      and make them readable. Python supports two types of comments: Single-line-comments and
                      multiline comments.

                      Single-line Comment
                      Python uses the hash (#) symbol for writing single-line comments.
                      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("Lakshya")
                      print("Devansh")

                      Output:  Roli
                                Lakshya
                                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.

                              uiz    Bee       1.  Variables are memory reference points where we store values.

                                               2.   An Integer is a collection of one or more characters put in single
                                                  or double-quotes.

                                OPERATORS IN PYTHON                                                    20 + 10

                      Operators  are the special  symbols that  are used  to  perform
                      computations.                                                                Operand      Operator
                      The values which the operators use to get the output are called operands.
                          (+) Addition operator: It is an arithmetic operator which is used to perform addition. Arithmetic
                        operators perform arithmetic operations between two operands.

                       98   Premium Edition-VI

| 95 96 97 98 99 100 101 102 103 104 105 |