0% found this document useful (0 votes)
2 views18 pages

Python Introduction

Uploaded by

anandsb8302
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views18 pages

Python Introduction

Uploaded by

anandsb8302
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

Python

Introduction
Chapter-1

Dr. K. Akilandeswari
Associate Professor
Why Python?
● Python is a general purpose high level programming language.

● It was developed by Guido van Rossum during 1985-1990 at Centrum


Wiskunde & Informatica (CWI) which is situated in Netherland.
● It is a dynamic and interpreted language with simple syntax and high
level data structures.
● It supports object oriented programming approach for application
development.
● Python is derived from languages ABC, Modula-3, C and C++ .
● The Python interpreter with extensive standard library is freely available for all
major platforms from the Python Web site https://www.python.org/.
Python features
Easy-to-learn :
Python features
Python has simple easy-to-use syntax and hence an excellent
language to learn for beginners.

Easy-to-read : Python’s elegant syntax makes it highly readable.

Open source : It is free and available at the official website under the GNU
General Public License (GPL).

Dynamic : It provides high-level dynamic data types and supports dynamic type
checking.

Portable : Python is a cross-platform language which can run on multiple


platforms like Windows, MacOS, Linux. So, Python is a portable language.
Broad Library : Python has a large standard library with rich set of
module and functions for rapid application development.
Extensible : allows programmers to add modules to Python interpreter for
customizing their tools.
Integrated : It can be easily integrated with C, C++, COM, ActiveX,
CORBA, and Java.
Databases : Python provides interfaces to all major commercial
databases.
GUI Programming : Python supports GUI application development with
supporting tools.
Python applications
Developing Website or Web application
○ Python can be used to make web-applications at a rapid rate, because of
the frameworks Python uses to create these applications.

○ Some of the most well-known frameworks are Django, Flask, Pyramid.

Perform Data Analysis


○ Data is money if you know how to extract relevant information which can
help you take calculated risks and increase profits.

○ Libraries such as Pandas, NumPy help you in extracting information.


Game Development
Python is also used in the development of interactive games. There are
libraries such as PySoy - a 3D game engine supporting Python 3.
Games such as Civilization-IV, Disney’s Toontown Online, Vega Strike
etc. have been built using Python.

Machine Learning and Artificial Intelligence


Machine Learning and Artificial Intelligence are the talks of the town as
they yield the most promising careers for the future.
We make the computer learn based on past experiences through the
data stored or better yet, create algorithms which makes the computer
learn by itself.
Web Scraping Applications

Python can be used to pull a large amount of data from websites which can

then be helpful in various real-world processes such as price comparison,

job listings, research and development and much more.

Developing Business applications like ERP

They require applications which are scalable, extensible and easily readable and
Python provides us with all these features. Platforms such as Tryton can be used to
develop such business applications.
Integrated Development Environment
● A text editor is a tool that is used to write and edit code.
● It is easy for the beginners to learn a programming language using text
editors.

● But when the size and complexity of the program increase, testing and
debugging becomes a hectic task.

● An IDE (Integrated Development Environment) understand the code


much better than a text editor.

● It helps the programmer to build automation, code linking, testing and


debugging.
Popular IDEs for Python programming
IDLE – Suitable for Beginner

Sublime Text 3 - Suitable for Beginner and Professional

Thonny - Suitable for Beginner

PyCharm - Suitable for Professional

Spyder - Suitable for Beginner and Professional

Atom - Suitable for Beginner and Professional


Python implementations
CPython : This is written in the language C, and is an interpreter. This is
the most widely accepted implementation of Python.

Jython : This implementation is written in Java. Jython programs use Java


classes instead of Python modules . A Jython program can use all java
libraries and frameworks.

IronPython : This is implemented in C#. This is a Python implementation


for the Microsoft-designed Common Language Runtime (CLR), commonly
known as .NET.
PyPy : This is an implementation of the Python programming language
written in Python. Jit (python compiler) is built with this. This has excellent
support of standard libraries and community libraries.

Brython : Browser Python is called as Brython. This implementation can


run on browsers.
Python Tokens
● Token is the smallest unit inside the given program.
● Tokens can be a punctuation mark, reserved words and each
individual word in a statement.
Following are the tokens of a python program.
· Identifiers
· Keywords
· Literals
Identifiers
Identifiers are names given to variables, functions, classes, objects etc. The rules for
naming the identifiers are :
▰ Identifiers can be a combination of letters in lowercase (a to z) or
uppercase (A to Z) or digits (0 to 9) or an underscore _ .
▰ An identifier cannot start with a digit.
▰ Keywords cannot be used as identifiers.
▰ Identifier can be of any length.
▰ Identifier names are case sensitive for example Student and student are not the same.
o Valid : student, STUDENT, Student1, student_1, _student1
o Invalid : 1student, student-name, student@class
Keywords
Keywords are reserved words that cannot be used as constant or variable or any other
identifier names.

All the Python keywords contain only lowercase letters.

The following list shows the the Python keywords.

and assert break class continue def del


elif else

except exec finally for from Global if


import in is lambda not or pass
print Raise return try while with
Literals
Literals can be defined as a data that is given in a variable or
constant.Python support the following literals:
▰ String literals
▰ Numeric literals
▰ Boolean literals
▰ Special literals
▰ Literal Collections
▰ Programming languages like C, C++, Java use braces { } to define a block of
code.
Python Indentation
▰ Python provides no braces to indicate blocks of code for function definitions
or flow control.
▰ Blocks of code are denoted by line indentation.
▰ The number of spaces in the indentation is not fixed. But it must be
consistent throughout that block.
▰ The strict and rigid enforcement of indentation in Python makes the code
look neat. It makes the code Easy-to-read.
Python Comments
▰ In python, any statement written with # symbol as the first character is known as a
comment.
▰ The interpreter does not interpret the comment and understands that it is not a part of
the program.
▰ Comments are included for programmers to understand and remember the concept of a
program, which also makes the program readable. Python Interpreter ignores the
comments.

Python supports two types of comments:

· Single Line Comment: # hash symbol is used

· Multi Line Comment: ’’’ or ””” triple quotes are used

You might also like