Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 119 - 2612_Digimind
P. 119

    KEYWORDS

                     Keywords are the reserved words. They are predefined words. Keywords cannot be used as an
                     identifier.

                     Some commonly used keywords in Python are given below:

                      False       assert         del            for           in               or             while

                      None        break          elif           from          is               pass           with

                      True        class          else           global        lambda           raise          yield
                      and         continue       except         if            nonlocal         return         async

                      as          def            finally        import        not              try            await

                     CONSTANTS OR LITERALS
                     Constants are fixed values that do not change during the execution of a program. Literals are the
                     type of constant. Literals refer to any number, text and other information that represents a value.
                     Python supports the following literals:

                                                  Literals                     Example

                                           String literals           "hello", ‘12345’

                                           Integer literals          0, 1, 2, -1, -2

                                           Long literals             89675

                                           Floating-point literals   3.14

                                           Complex literals          12j

                                           Boolean literals          True or False

                                           Special literals          None

                                           Unicode literals          u"hello"

                                           List literals             [5,6,7]

                     OPERATORS
                     Operators are special symbols that are used to perform specific operation on operands and give
                     a meaningful result. Operands are the data involved in the mathematical operation and may be

                     stored in variables and constants.

                                                                                        Tokens and Data Types in Python  117

| 114 115 116 117 118 119 120 121 122 123 124 |