Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 107 - 2606_PlugGPT_C7_Flipbook
P. 107

    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]

                          Tick ( ) if you know this.
                          ▶   Identifiers refer to variables, functions and list.
                          ▶  A token is the smallest element of a Python program that is meaningful to the interpreter.

                     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  105

| 102 103 104 105 106 107 108 109 110 111 112 |