Python
Introduction Python features
Python is a popular programming language. Easy-to-learn: Python is clearly defined and easily readable. The structure
It was created by Guido van Rossum, and released in 1991. of the program is very simple. It uses few keywords (predefined words in
It is case sensitive i.e. it treats upper and lower case differently. Python).
Python is a general-purpose interpreted, interactive, object-oriented, and Eg:
high-level programming language. When to write “Hello world!”
o Python is interpreted: Python is processed at runtime by the In C language, then code is:
interpreter. It does not need compilation time before execution.
o Python is Interactive: It is easy to learn Python as programmer can
directly interact with the interpreter directly to write your programs.
o Python is Object-Oriented: Python supports Object-Oriented style
or technique of programming that encapsulates code within objects.
o Python is a Beginner's Language: Python is a great language for In Python language is;
the beginner Level programmers and supports the development of a
wide range of applications.
Easy-to-maintain: Python's source code is fairly easy-to-maintain.
Python program cycle Portable: Python can run on a wide variety of hardware platforms and has
the same interface on all platforms.
Interpreted: Python is processed at runtime by the interpreter. So, there is
no need to compile a program before executing it. You can simply run the
program.
Extensible: Programmers can embed python within their C,C+
+,JavaScript , ActiveX, etc.
Free and Open Source: Anyone can freely distribute it, read the source
code, and edit it.
High Level Language: When writing programs, programmers concentrate
on solutions of the current problem, no need to worry about the low level
details.
Scalable: Python provides a better structure and support for large programs
than shell scripting.
Application of Python 3. Literals
Literals are data items that have fixed/constant values
web development (server-side),
software development,
mathematics,
system scripting.
Tokens in Python
The smallest individual unit in a program is known as Token or lexical unit.
Python tokens are:
o Keywords
o Identifiers
o Literals
o Operators
o Punctuators
1. Keywords in Python
These are predefined words with special meaning to the language
compiler or interpreter.
These are reserved for speacis=al purpose and must not be used as
normal identifier names.
Eg: False, True, del, None, class, in, or, and, etc.
2. Identifiers in Python
Identifiers are the names given to different parts of the program
viz. variables, object, classes, functions, lists, dictionaries and so
forth.
The naming rules for Python identifiers can be as follows:
Names must only be non- keyword word
There should not be any space
Name must contain number, alphabets, and underscore (_)
It cannot begin with number but con contain number
Verified identifiers Invalid Identifiers
Myfile, DATE_7, DATA-REC, 29clct, break,
MYFILE, etc etc