Professional Documents
Culture Documents
XII_CH1_PR1
XII_CH1_PR1
Practical 1
Introduction:
Python programming language, developed by Guido Van Rossum in early 1990s, has become
a very popular programming language among beginners as well as developers.
Tokens:
The smallest individual unit in a program is known as a Token or a lexical unit.
Python has following tokens:
i) Keywords:
A keyword is a word having special meaning reserved by programming language.
Python programming language contains the following keywords:
ii) Identifiers:
Identifiers are the names given to different parts of the program namely variables,
objects, classes, functions, lists, dictionaries and so forth.
The naming rules for Python identifiers can be summarized as follows:
a) Variable names must only be a non-keyword word with no spaces
between.
b) Variable names must be made up of only letters, numbers, and underscore
(_)
c) Variable names cannot begin with a number, although they can contain
numbers
iii) Literals/Values:
Literals are data items that have a fixed/constant value. Python allows several
kinds of literals, which are being given below:
a) String Literals:
String literals is a sequence of characters surrounded by quotes (single or
double or triple quotes). Strings can either be single line strings or multi-line
strings
• Single line strings must terminate in one line i.e., the closing
quotes should be on the same line as that of the opening quotes.
1
# PRG1 Demonstrates types of strings in Python
Output: