Page 122 - Trackpad_V1_Book 6_Flipbook
P. 122

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(“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.



                                           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
                                                                                                   20 + 10
                  Operators  are the special  symbols that  are used  to  perform
                  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 operators: It multiplies values on either side of the operator.



                  120   Trackpad (Version 1.0)-VI
   117   118   119   120   121   122   123   124   125   126   127