Page 134 - Trackpad_V1_Book 7_Flipbook
P. 134

TOKENS AND DATA                                                                        CHAPTER


                  TYPES IN PYTHON                                                                        10                                             PYTHON CHARACTER SET

                                                                                                                                            A set of valid characters recognised by a language is called a character set. The characters used
                                                                                                                                            in the Python source program belong to the Unicode standard. The characters in Python are
                                                                                                                                            grouped into the following categories:
                                                                                                                                                Alphabet:  A to Z(uppercase), a to z (lowercase)

                                                                                                                                                Digits: 0 to 9

                                                                                                                                                Special characters (:) colon space ( ) + _- * / /\ ^ & % # $ {} []! _(underscore) >< ?@ , ; : etc.
                                                                                                                                                (white space, blank space, horizontal tab ( ), carriage return, New line, form feed)

                                Welcome  again,  young  girl. In                                                                            Python can process any of the ASCII and Unicode characters as data or as literals.
                                today’s  session,  you  will learn           Topics Covered                      95%
                                about  various  data  types  used  in            Python Character Set
                                Python.                                          Python Tokens                                                          PYTHON TOKENS
                                                                                 Data Types                                                 A token is the smallest element of a Python program that is meaningful to the interpreter. You
                                                                                 Find Data Type
                                                                                 Errors in Python Programs                                  have learned about some tokens in the previous class. Now learn more about them in detail.
                                                                                 Some More Programs
                  Thank you,  Techie.  Will  I be                                                                                                                                    PYTHON TOKENS
                  able to develop programs after
                  that?



                                                                                                                                               IDENTIFIERS         KEYWORDS            CONSTANTS           OPERATORS           PUNCTUATORS
                                    Yes, you will be able to create simple programs but you need regular practice
                                    and more knowledge to be able to do more than that.                                                     IDENTIFIERS

                                                                                                                                            An identifier is a sequence of characters taken from a Python character set. It refers to variables,
                                                                                                                                            functions and arrays. The rules for identifiers are:

                                                                                                                                                Only alphabet, digits and underscores are permitted.
                                       Techie, can you tell me what we can do using Python?
                                                                                                                                                Must start with a letter between A to Z or between a to z or an underscore (_).
                                                                                                                                                Uppercase and lowercase are distinct because Python is a case-sensitive language.

                                                                                                                                                Special characters are not allowed.
                               Python is a multi-purpose programming language. We can use it for a variety of

                               tasks. We can learn Python for machine learning and AI. In fact, Python is the best                          Some examples of valid identifiers are Myvar, myvar_1, Sum_of_the_numbers, PASS and _Sum.
                               language for machine learning and data science projects. Python is also popular for                          Some examples of invalid identifiers are Global, Var^2, Var 1 and 1var.
                               website development. Let us take the next step in learning the Python programming
                               language.                                                                                                    KEYWORDS
                                                                                                                                            Keywords are reserved words. They are predefined words. Keywords cannot be used as identifier
                                                                                                                                            names.





                  132   Trackpad (Version 1.0)-VII
   129   130   131   132   133   134   135   136   137   138   139