Page 146 - trackpad v5.1 class 7 flipbook
P. 146
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 ( ) + _- * / /\ ^ & % # $ {} []! _(underscore) >< ?@ , ; etc. (white space,
blank space, horizontal tab ( ), carriage return, new line, form feed)
Python can process any of the ASCII and Unicode characters as data or as literals.
PYTHON TOKENS
A token is the smallest element of a Python program that is meaningful to the interpreter. You
have learned about some tokens in the previous class. Now learn more about them in detail.
PYTHON TOKENS
IDENTIFIERS KEYWORDS CONSTANTS OPERATORS PUNCTUATORS
IDENTIFIERS
An identifier is a sequence of characters taken from the Python character set. It refers to variables,
functions and arrays. The rules for identifiers are:
Only letters, digits and an underscore are permitted.
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.
Some examples of valid identifiers are Myvar, myvar_1, Sum_of_the_numbers, PASS and _Sum.
Some examples of invalid identifiers are False, Var^2, Var 1 and 1var.
KEYWORDS
Keywords are the reserved words. They are predefined words. Keywords cannot be used as an
identifier.
144 Pro (V5.1)-VII

