0% found this document useful (0 votes)
20 views38 pages

TOPIC: Introduction To Python: Course

The document is an introductory presentation on Python programming, covering its history, features, uses, and installation methods. It highlights the differences between Python 2.x and 3.x, and discusses various distributions like CPython and Anaconda. The presentation also includes instructions for working in Python using different modes and tools such as Jupyter Notebook and Spyder IDE.

Uploaded by

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

TOPIC: Introduction To Python: Course

The document is an introductory presentation on Python programming, covering its history, features, uses, and installation methods. It highlights the differences between Python 2.x and 3.x, and discusses various distributions like CPython and Anaconda. The presentation also includes instructions for working in Python using different modes and tools such as Jupyter Notebook and Spyder IDE.

Uploaded by

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

TOPIC: Introduction to Python

COURSE: PYTHON PROGRAMMING

PPT SL.NO.: 01 of 38

VERSION: 01 LAST UPDATED ON: 12/07/2021

Presentation By: Vinay Kant


Content
 Introduction to Python
 History of Python
 Features of Python
 Where is Python uses?
 What can Python do?
 Python used by Companies
 Python’s Version
 Python 2.X Vs Python 3.X
 Python Installation –
 CPython
 Anaconda Distribution
Introduction to Python

Python is a general purpose, dynamic, high level


and interpreted programming language. It supports
Object Oriented programming and procedure
oriented approach to develop applications. It is
simple and easy to learn and provides lots of high-
level data structures.
History of Python
Python was created by Guido Van Rossum when he
was working at National Research Institute for
Mathematics and Computer Science in Netherlands.
The language was released in 1991. Python got its
name from a BBC comedy series - “Monty Python’s
Flying Circus”.
History of Python
 Python is derived from many other languages, including ABC,
Modula-3, C, C++, Algol-68, SmallTalk, and Unix shell and
other scripting languages.

 Python is copyrighted. Like Perl, Python source code is now


available under the GNU General Public License (GPL).

 Python is now maintained by a core development team at the


institute, although Guido van Rossum still holds a vital role in
directing its progress.
Features of Python
 It is a general purpose programming language which can be used for both scientific
and non scientific programming.

 It is a platform independent programming language. Python works on different


platforms (Windows, Mac OS, Linux, Raspberry Pi, etc).

 It is a very simple high level language with vast library of add-on modules.

 Python runs on an interpreter system, meaning that code can be executed as soon as
it is written. This means that prototyping can be very quick.

 Programs written in Python are easily readable and understandable. It’s Syntax
very simple that’s why Python is said to Beginner's programming Language.

 It is suitable as an extension language for customizable applications.

 It is easy to learn and use. It is Open source programming language.


Where is Python uses?
It is used for:
 Web development (server-side)

 Software development

 Mathematics

 System scripting
Q. What can Python do?

 Python can be used on a server to create web


applications.
 Python can connect to database systems. It can also
read and modify files.
 Python can be used to handle big data and
perform complex mathematics.
 Python can be used for rapid prototyping, or for
production-ready software development.
Python used by Companies
 In operations of Google search engine, youtube etc.

 Bit Torrent peer to peer file sharing is written using Python.

 Intel, Cisco, HP, IBM, etc use Python for hardware testing.

 Maya provides a Python scripting API (application programming


interface)

 i–Robot uses Python to develop commercial Robot.

 NASA, ISRO and others use Python for their scientific


programming task.
Python’s Version
Python has basically two Version:
 Python2.x

 Python3.x

 Python 2.0 was released on 16 October 2000 with

many major new features, including a garbage


collector.
 Python 3.0 was released on 3 December 2008.
Python 2.X Vs Python 3.X
Python Install
 Many PCs and Macs will have python already installed.

 To check if you have python installed on a Windows PC, search in the start
bar for Python or run the following on the Command Line (cmd.exe):
C:\Users\Your Name>python –version

 To check if you have python installed on a Linux or Mac, then on linux open
the command line or on Mac open the Terminal and type:
python –version

 If you find that you do not have python installed on your computer, then you
can download it for free from the following
website: https://www.python.org/
Working in Python
 Before you start working in Python, you need to install Python
on your computer.

 There are multiple Python Distributions available.

1. Default installation available from www.python.org is called


CPython installation and comes with Python interpreter,
Python IDLE (Python GUI) and Pip(package installer).

2. Other is Anaconda Python Distribution is one such highly


recommended distribution that comes preloaded with many
packages and libraries
(e.g., NumPy, SciPy, Panda libraries etc. )
Default CPython Distribution
Working in Default CPython
Distribution
 The default distribution, CPython comes with Python
interpreter, Python IDLE (GUI based) and pip
(package installer).

 You can work in Python in following different modes.


1. Working in Interactive Mode(Python IDLE)
2. Working in Script Mode (Python IDLE)
Working in Interactive Mode
(Python IDLE)
 Interactive mode of working means you type the
command - one command at a time, and the Python
executes the given command and then give the
output.
 In interactive mode, you type the command in front
of Python command prompt >>>.
 For Example:
>>>2+5 Command given here
Result returned by Python
7
To Work in Interactive Mode
1. Click Start button All Programs Python 3.7.0

IDLE (Python GUI)

OR
Click Start button All Programs Python
(Command Line)
To Work in Interactive Mode
2. It will open Python Shell where you will see the
Python prompt (signs i.e., >>>).

Python command prompt (see >>>)


In interactive mode, you type command in
front of this
To Work in Interactive Mode
3. Type commands in front of this Python prompt and
will immediately gives the result by Python
interpreter .

See various commands typed on prompt


>>> and python immediately returns
output
Working in Script Mode (Python IDLE)

 If you want to save all the commands in the form of


program file and want to see output lines together,
you can use Script Mode.
Working in Script Mode (Python IDLE)

Step1. Create Module/script/program file


Firstly, You have to create and save a module/script/program file.
To do so, follow these instruction:
a. Click Start button All Programs Python 3.7.0 IDLE (Python GUI)
b. Click File New in IDLE Python Shell
c. In the New window that open, type the commands you want to save in the form of a program (or script).
d. Click File Save and then save the file with extension .py
Working in Script Mode (Python IDLE)

Step2. Run Module/script/program file


After the program/script file saved, you can run it
a. Click Run Run Module command
b. It will execute all the commands stored in program/script that you had
opened and show you complete output in a separate python shell window.
ANACONDA DISTRIBUTION
Working in Anaconda Distribution
 Anaconda distribution comes with many preloaded
packages and libraries.
 In Anaconda Distribution, both Interactive and
Script Mode present.
 Anaconda Distribution provides the tools such as
Jupyter notebook and Spyder that you can use to
work in Python.
Jupyter Notebook
 Jupyter Notebook is an open source web
application.

 It can be use to create and share documents that


contain live code, equations, numerical simulation,
statistical modeling, data visualization, machine
learning and much more.
Working in Jupyter Notebook
In order to work jupyter notebook, you need to first launch it
using Anaconda Navigator as it has come preloaded with
Anaconda Distribution.
Step 1: Launch Anaconda Navigator.
Step 2: From the Anaconda Navigator window, click on Launch
below Jupyter notebook tile.
Working in Jupyter Notebook
Step 3: Since jupyter notebook is web based computing
environment, it will be launched in a web browser.
Step 4: On the notebook dashboard, click New button and select
Python 3.
Working in Jupyter Notebook
Step 5: it will open a new notebook where you can write and run
your code.
Working in Jupyter Notebook
Step 6: Interactive Mode
To run Python code in interactive mode, type code in cell
and click run.
Working in Jupyter Notebook
Step 7: Script Mode
To run a script mode :
(a) Write the code of a Python script (a group of Python
commands) in a code cell.
(b) Now click on its name to give new name.
Working in Jupyter Notebook
(c) Click on Save icon first to save it and now click Run
to run your Script.
Spyder IDE
 Spyder is an open source cross-platform integrated
development environment (IDE) .for scientific
programming in the Python language.
 Spyder integrates with a number of prominent
packages in the scientific Python stack,
including NumPy, SciPy, pandas etc.
 It is available cross-platform through Anaconda on
Windows.
Working in Spyder IDE
Step 1: Launch Anaconda Navigater.
Step 2: From the Navigator window, click on Launch below
Spyder tile.
Working in Spyder IDE
Step 3: Once spyder in loaded, you will see following interface.
Working in Spyder IDE
Step 4: Interactive Mode:
To work in interactive mode, type your command(s) in the
IPython console pane and it will give you output of the
command there itself.
Type command:
print(“Hello World”)

OUTPUT:
Hello World

IPython console
Working in Spyder IDE
Step 5: Script Mode:
To work in script mode, type your command in the editor pane.
(a) To start a new script file, click File New File…
(b) To save current script, use command File Save

Editor Pane
Working in Spyder IDE
Script Mode:
(c) Now you can run by clicking at Run command or press F5.
Thank you!
If you have any query, please contact:

Vinay Kant
Contact no: +91-8393903778
email: [email protected]

www.nielit.gov.in/haridwar

You might also like