Class -1
INTRODUCTION
History
Python is a fairly old language created by Guido Van Rossum. The design began in the late
1980’s and was first released in February 1991.
In late 1980’s Guido Van Rossum was working on the Amoeba Distributed Operating
System Group.
He wanted to use an interpreted language like ABC (ABC has simple easy-to-understand
syntax) that could access the Amoeba System Calls. So, he decided to create a language
that was extensible. This led to design a new language.
Now a day, it became much popular because it is highly productive as compared with
other programming languages.
It has grown to be one of the most widely used Web and system scripting languages.
Python is interpreted, object oriented and high level programming language.
Python is a cross-platform programming language, meaning, it runs on multiple platforms
like Windows, Mac OS X, Linux, Unix and has even been ported to the Java and .NET virtual
machines.
Python has a wide variety of uses, including the following:
Command-line tools development
Web development (ex:- Django)
Component integration
Database access and manipulation
Distributed programming
Parsing
Image processing
Scientific programming
Features of Python Programming
1. A simple language which is easier to learn
2. Free and open source
3. Portability
4. Extensible and Embedded
5. A high level, interpreted language
6. Large standard libraries to solve common tasks
7. It supports procedure and object oriented
Python released in different versions
- Python 2.7
- Python 3.5
- Python 3.6
- Python 3.7
- Python 3.8 also released
CHAITANYA DEEMED TO BE UNIVERSITY By T.Ranjith Kumar, Assistant Professor
, Class - 2
Basic Python Syntax
1. The Python language has many similarities to Perl, C, and Java. However, there are some
definite differences between the languages.
2. Interactive Mode Programming
3. Script Mode Programming
4. Python Identifiers
A Python identifier is a name used to identify a variable, function, class, module or other
object. An identifier starts with a letter A to Z or a to z or an underscore _ followed by
zero or more letters, underscores and digits 0to9.
Python does not allow punctuation characters such as @, $, and % within identifiers.
Python is a case sensitive programming language. Thus, Manpower and manpower are
two different identifiers in Python.
Here are naming conventions for Python identifiers
Class names start with an uppercase letter. All other identifiers start with a
lowercase letter.
Starting an identifier with a single leading underscore indicates that the identifier
is private.
Starting an identifier with two leading underscores indicates a strongly private
identifier.
If the identifier also ends with two trailing underscores, the identifier is a
language-defined special name.
5. Reserved Words
The following list shows the Python keywords. These are reserved words and we cannot
use them as constant or variable or any other identifier names. All the Python keywords
contain lowercase letters only.
and exec not
assert finally or
break for pass
class from print
continue global raise
def if return
del import try
elif in while
else is with
except lambda yield
CHAITANYA DEEMED TO BE UNIVERSITY By T.Ranjith Kumar, Assistant Professor
, 6. Lines and Indentation
Python provides no braces to indicate blocks of code for class and function
definitions or flow control. Blocks of code are denoted by line indentation, which
is rigidly enforced.
The number of spaces in the indentation is variable, but all statements within the
block must be indented the same amount.
7. Multi-Line Statements
Statements in Python typically end with a new line. Python does, however, allow
the use of the line continuation character (\) to denote that the line should
continue.
8. Quotation in Python
Single Quotation (‘ ‘)
Double Quotation(“ “)
9. Comments in Python
In python comments are placed with a symbol ‘#’
10. Multiple Statements on a Single Line
When we write statements in a single line each statement is separated by semi
colon (;) it indicates the statement completed.
CHAITANYA DEEMED TO BE UNIVERSITY By T.Ranjith Kumar, Assistant Professor
INTRODUCTION
History
Python is a fairly old language created by Guido Van Rossum. The design began in the late
1980’s and was first released in February 1991.
In late 1980’s Guido Van Rossum was working on the Amoeba Distributed Operating
System Group.
He wanted to use an interpreted language like ABC (ABC has simple easy-to-understand
syntax) that could access the Amoeba System Calls. So, he decided to create a language
that was extensible. This led to design a new language.
Now a day, it became much popular because it is highly productive as compared with
other programming languages.
It has grown to be one of the most widely used Web and system scripting languages.
Python is interpreted, object oriented and high level programming language.
Python is a cross-platform programming language, meaning, it runs on multiple platforms
like Windows, Mac OS X, Linux, Unix and has even been ported to the Java and .NET virtual
machines.
Python has a wide variety of uses, including the following:
Command-line tools development
Web development (ex:- Django)
Component integration
Database access and manipulation
Distributed programming
Parsing
Image processing
Scientific programming
Features of Python Programming
1. A simple language which is easier to learn
2. Free and open source
3. Portability
4. Extensible and Embedded
5. A high level, interpreted language
6. Large standard libraries to solve common tasks
7. It supports procedure and object oriented
Python released in different versions
- Python 2.7
- Python 3.5
- Python 3.6
- Python 3.7
- Python 3.8 also released
CHAITANYA DEEMED TO BE UNIVERSITY By T.Ranjith Kumar, Assistant Professor
, Class - 2
Basic Python Syntax
1. The Python language has many similarities to Perl, C, and Java. However, there are some
definite differences between the languages.
2. Interactive Mode Programming
3. Script Mode Programming
4. Python Identifiers
A Python identifier is a name used to identify a variable, function, class, module or other
object. An identifier starts with a letter A to Z or a to z or an underscore _ followed by
zero or more letters, underscores and digits 0to9.
Python does not allow punctuation characters such as @, $, and % within identifiers.
Python is a case sensitive programming language. Thus, Manpower and manpower are
two different identifiers in Python.
Here are naming conventions for Python identifiers
Class names start with an uppercase letter. All other identifiers start with a
lowercase letter.
Starting an identifier with a single leading underscore indicates that the identifier
is private.
Starting an identifier with two leading underscores indicates a strongly private
identifier.
If the identifier also ends with two trailing underscores, the identifier is a
language-defined special name.
5. Reserved Words
The following list shows the Python keywords. These are reserved words and we cannot
use them as constant or variable or any other identifier names. All the Python keywords
contain lowercase letters only.
and exec not
assert finally or
break for pass
class from print
continue global raise
def if return
del import try
elif in while
else is with
except lambda yield
CHAITANYA DEEMED TO BE UNIVERSITY By T.Ranjith Kumar, Assistant Professor
, 6. Lines and Indentation
Python provides no braces to indicate blocks of code for class and function
definitions or flow control. Blocks of code are denoted by line indentation, which
is rigidly enforced.
The number of spaces in the indentation is variable, but all statements within the
block must be indented the same amount.
7. Multi-Line Statements
Statements in Python typically end with a new line. Python does, however, allow
the use of the line continuation character (\) to denote that the line should
continue.
8. Quotation in Python
Single Quotation (‘ ‘)
Double Quotation(“ “)
9. Comments in Python
In python comments are placed with a symbol ‘#’
10. Multiple Statements on a Single Line
When we write statements in a single line each statement is separated by semi
colon (;) it indicates the statement completed.
CHAITANYA DEEMED TO BE UNIVERSITY By T.Ranjith Kumar, Assistant Professor