SlideShare une entreprise Scribd logo
1  sur  48
Akhil Kaushik
Asstt. Prof., CE Deptt.,
TIT Bhiwani
Python
Programming
Python Introduction
• Python is a popular programming
language.
• It was created by Guido van Rossum,
and released in 1991.
• Python source code is also available
under the GNU General Public License
(GPL).
Python Introduction
• Python is a general-purpose interpreted,
interactive, object-oriented and high-level
programming language.
• Python is designed to be highly readable.
• Python has a simple syntax similar to the English
language.
Programming….Why?
Type of Languages
1. Binary Level
Language
2. Assembly Level
Language
3. High Level
Language
Need for programming languages?
• Closer to human thinking behavior.
• Program’s size is shorter.
• Error detection is easy.
• Same program can be compiled in accordance
to different machine architectures.
History
• Software for early computers were
written in assembly language.
• The need of reusability of code gave
birth to programming languages.
• This need grow huge to overcome the
cost restriction of compiler.
Translators
What is a Compiler?
What is a Compiler?
Source Language Target Language
Translators - Interpreter
• It is another common kind of language processor.
• Instead of producing a target program as a
translation, it directly execute the operations
specified in the source program on inputs supplied
by the user.
Translators - Interpreter
• This software converts the high-level language
into low-level language line by line.
• It takes less memory than compiler.
• It takes more time than compiler.
• It is more efficient in error detection than
compiler.
• It takes more time to build.
Translators - Interpreter
• Java language processors combine compilation
and interpretation.
• A Java source program may first be compiled into
an intermediate form called bytecodes.
• The bytecodes are then interpreted by a virtual
machine.
• A benefit of this arrangement is that bytecodes
compiled on one machine can be interpreted on
another machine, perhaps across a network.
Translators - Interpreter
Translators - Assembler
• This software converts the assembly language
(assembly instruction mnemonics) into machine
level language (opcodes i.e. 0,1).
• It offers reusability of assembly codes on different
machine platforms.
Translators - Assembler
• It generates instructions by evaluating the
mnemonics (symbols) in operation field and find
the value of symbol and literals to produce
machine code.
• Now, if assembler do all this work in one scan then
it is called single pass assembler, otherwise if it
does in multiple scans then called multiple pass
assembler.
Translators - Assembler
• Pass-1:
– Define symbols and literals and remember them in
symbol table and literal table respectively.
– Keep track of location counter
– Process pseudo-operations
• Pass-2:
– Generate object code by converting symbolic op-code
into respective numeric op-code
– Generate data for literals and look for values of
symbols
Translators - Assembler
Translators - Linker
• A linker is a program that allows a user
to link library programs or separate
modules of code into their own
programs.
• It is used to combine different modules
of object code into one single
executable code program.
Translators - Linker
• This may involve combining a program with library
programs, or involve recombining blocks of object
code from the same program, or a mixture of both.
• The linker program is used to recombine the
blocks of object code in RAM to get a working full
program.
• Linker is helpful if there is a shortage of RAM.
Translators - Loader
• A loader is a piece of software that chooses
exactly where to put object code in RAM, ready for
it to be run.
• It also adjusts the memory references in programs.
Translators - Loader
• Programs can be written by programmers using
either ‘absolute addressing’ or ‘relative addressing’.
• Relative addressing is more common because then
the loader can put the program anywhere in RAM -
absolute addressing isn't flexible.
• Linker & Loader may overlap.
Translators - Loader
Why Python?
• It is used for:
– web development (server-side applications),
– software development (rapid prototyping),
– handling big data and mathematics,
– Connecting to database systems,
– system scripting.
Why Python?
• It supports functional and object oriented
programming.
• It can be used as a scripting language or can be
compiled to byte-code for building large applications.
• It provides very high-level dynamic data types and
supports dynamic type checking.
• It supports automatic garbage collection.
Why Python?
• Python works on different platforms (Windows, Mac,
Linux, Raspberry Pi, etc).
• Python has syntax that allows developers to write
programs with fewer lines.
• Python runs on an interpreter system, which makes
prototyping very quick.
• It can be easily integrated with C, C++, COM,
ActiveX, CORBA, and Java.
Why Python?
• The current version is Python 3.8
• Earlier version – Python 2 is quite
popular and has frequent security
updates.
• Some other versions of Python
are 1.0, 1.5, 1.6, 2.0, 2.1, 2.2, 2.3,
2.4, 2.5, 2.6, 2.7, 3.0, 3.1, 3.2,
3.3, 3.4, 3.5, 3.6, 3.7.
Summary - Why Python?
• Easy to learn, read and maintain
• Broad standard library for all
platforms.
• Portable & extendable.
• Interactive testing & debugging.
• Support for all major databases.
• Support for GUI applications.
Summary - Why Python?
• Python uses new lines
to complete a command,
instead of ; or {}.
• Python relies on
indentation, using
whitespace, to define
scope; such as the
scope of loops,
functions and classes.
How to get started?
• Usually, Python comes pre-installed in Windows,
Linux and Mac OS.
• To check, search in the start bar for Python or run
the following on the Command Line (cmd.exe):
C:UsersYour Name>python --version
How to get started?
• Else, we can download python from website:
https://www.python.org/
• You can download Python documentation from:
https://www.python.org/doc/
• The documentation is available in HTML, PDF, and
PostScript formats.
Steps to Install Python on Windows
• Open a Web browser and go
to https://www.python.org/downloads/.
• Follow the link for the Windows installer python-XYZ.msi file
where XYZ is the version you need to install.
• Save the installer file to your local machine and then run it to
find out if your machine supports MSI.
• Run the downloaded file. This brings up the Python install
wizard, which is really easy to use. Just accept the default
settings, wait until the install is finished, and you are done.
Steps to Install Python on Linux
• Open a Web browser and go to https://www.python.org/downloads
• Follow the link to download zipped source code available for
Unix/Linux.
• Download and extract files.
• Editing the Modules/Setup file if you want to customize some
options.
• run ./configure script -> make -> make install
• This installs Python at standard location /usr/local/bin and its
libraries at /usr/local/lib/pythonXX where XX is the version of
Python.
Steps to Install Python on Macintosh
• Recent Macs come with Python installed, but it
may be several years out of date.
• See http://www.python.org/download/mac/ for
instructions on getting the current version along
with extra tools to support development on the
Mac.
Setting up Path - Windows
• To add the Python directory to the path for a
particular session in Windows −
• At the command prompt − type path ->
Environment Variables -> path -> edit ->
%path%;C:Python and press Enter.
• Note − C:Python is the path of the Python directory
Setting up Path - Linux
• In the csh shell − type setenv PATH
"$PATH:/usr/local/bin/python" and press Enter.
• In the bash shell (Linux) − type export
PATH="$PATH:/usr/local/bin/python" and press Enter.
• In the sh or ksh shell − type
PATH="$PATH:/usr/local/bin/python" and press Enter.
• Note − /usr/local/bin/python is the path of the Python
directory
Running Python Code
• Interactive Interpreter (write Python or IPython in
command prompt)
– C:> python
• Script from the Command-line (write python code in
an editor and save with .py extension, then call
interpreter to run it)
– C: >python script.py
• Integrated Development Environment (IDE)
Python IDEs
• Jupyter
• Spyder
• Thonny
• PyCharm
• Komodo
• NetBeans
• &….so plethora of options…
Jupyter Notebook
• It is an open-source web application
that allows you to create and share
documents that may contain:
– Data cleaning & transformation,
– Equations & numerical simulation,
– Data visualizations and narrative text.
– Machine learning
– Deep learning
Jupyter Notebook
• Project Jupyter is a non-profit, open-source
project, born out of the IPython Project in 2014.
• It supports over 40 languages.
• It can also help us share notebooks.
• It gives interactive output.
• It also does big data integration.
Let’s start writing code…
Let’s start writing code…
• Download Anaconda from internet.
• I have anaconda 4.4.0 (64-bit).
• Write ‘Jupyter’ in the search box -> Jupyter Notebook.
• It will start and a new tab will open in your default
browser.
• Click on “New” dropdown box -> Python3
Let’s start writing code…
Let’s start writing code…
Let’s start writing code…
Keyboard shortcuts - Jupyter Notebook
• Shift + Enter run the current cell, select
below
• Ctrl + Enter run selected cells
• Alt + Enter run the current cell, insert below
• Ctrl + S save and checkpoint
• Ctrl + ] indent
• Ctrl + [ dedent
• H show all shortcuts
• Z undo cell deletion
• S Save and Checkpoint
• A insert cell above
• B insert cell below
• X cut selected cells
• C copy selected cells
• V paste cells below
• Shift + V paste cells above
• Y change the cell type to
Code
• M change the cell type to
Markdown
First Program
Akhil Kaushik
akhilkaushik05@gmail.com
9416910303
CONTACT ME AT:
Akhil Kaushik
akhilkaushik05@gmail.com
9416910303
THANK YOU !!!

Contenu connexe

Tendances

Introduction To Python | Edureka
Introduction To Python | EdurekaIntroduction To Python | Edureka
Introduction To Python | EdurekaEdureka!
 
Introduction to the basics of Python programming (part 1)
Introduction to the basics of Python programming (part 1)Introduction to the basics of Python programming (part 1)
Introduction to the basics of Python programming (part 1)Pedro Rodrigues
 
Python Programming language
Python Programming languagePython Programming language
Python Programming languageHadeelAlbedah
 
Python Projects For Beginners | Python Projects Examples | Python Tutorial | ...
Python Projects For Beginners | Python Projects Examples | Python Tutorial | ...Python Projects For Beginners | Python Projects Examples | Python Tutorial | ...
Python Projects For Beginners | Python Projects Examples | Python Tutorial | ...Edureka!
 
An introduction to Python for absolute beginners
An introduction to Python for absolute beginnersAn introduction to Python for absolute beginners
An introduction to Python for absolute beginnersKálmán "KAMI" Szalai
 
Python programming | Fundamentals of Python programming
Python programming | Fundamentals of Python programming Python programming | Fundamentals of Python programming
Python programming | Fundamentals of Python programming KrishnaMildain
 
Intro to Python Programming Language
Intro to Python Programming LanguageIntro to Python Programming Language
Intro to Python Programming LanguageDipankar Achinta
 
Python Programming ppt
Python Programming pptPython Programming ppt
Python Programming pptismailmrribi
 
Python - An Introduction
Python - An IntroductionPython - An Introduction
Python - An IntroductionSwarit Wadhe
 
Data Type Conversion in C++
Data Type Conversion in C++Data Type Conversion in C++
Data Type Conversion in C++Danial Mirza
 

Tendances (20)

Introduction To Python | Edureka
Introduction To Python | EdurekaIntroduction To Python | Edureka
Introduction To Python | Edureka
 
Python ppt
Python pptPython ppt
Python ppt
 
Introduction to the basics of Python programming (part 1)
Introduction to the basics of Python programming (part 1)Introduction to the basics of Python programming (part 1)
Introduction to the basics of Python programming (part 1)
 
Python Programming language
Python Programming languagePython Programming language
Python Programming language
 
Python basics
Python basicsPython basics
Python basics
 
Python Projects For Beginners | Python Projects Examples | Python Tutorial | ...
Python Projects For Beginners | Python Projects Examples | Python Tutorial | ...Python Projects For Beginners | Python Projects Examples | Python Tutorial | ...
Python Projects For Beginners | Python Projects Examples | Python Tutorial | ...
 
Python
PythonPython
Python
 
An introduction to Python for absolute beginners
An introduction to Python for absolute beginnersAn introduction to Python for absolute beginners
An introduction to Python for absolute beginners
 
Python
PythonPython
Python
 
Python programming | Fundamentals of Python programming
Python programming | Fundamentals of Python programming Python programming | Fundamentals of Python programming
Python programming | Fundamentals of Python programming
 
Intro to Python Programming Language
Intro to Python Programming LanguageIntro to Python Programming Language
Intro to Python Programming Language
 
Introduction to the Python
Introduction to the PythonIntroduction to the Python
Introduction to the Python
 
Python
PythonPython
Python
 
Python Programming ppt
Python Programming pptPython Programming ppt
Python Programming ppt
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Python - An Introduction
Python - An IntroductionPython - An Introduction
Python - An Introduction
 
Data Type Conversion in C++
Data Type Conversion in C++Data Type Conversion in C++
Data Type Conversion in C++
 
Python
PythonPython
Python
 
Python Basics.pdf
Python Basics.pdfPython Basics.pdf
Python Basics.pdf
 
Introduction to Python Basics Programming
Introduction to Python Basics ProgrammingIntroduction to Python Basics Programming
Introduction to Python Basics Programming
 

Similaire à Introduction to Python Programming

Python quick guide1
Python quick guide1Python quick guide1
Python quick guide1Kanchilug
 
Introduction to Python Programming Basics
Introduction  to  Python  Programming BasicsIntroduction  to  Python  Programming Basics
Introduction to Python Programming BasicsDhana malar
 
Introduction to python history and platforms
Introduction to python history and platformsIntroduction to python history and platforms
Introduction to python history and platformsKirti Verma
 
computer languages
computer languagescomputer languages
computer languagesRajendran
 
python intro and installation.pptx
python intro and installation.pptxpython intro and installation.pptx
python intro and installation.pptxadityakumawat625
 
Python_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptxPython_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptxlemonchoos
 
Compiler Design Introduction
Compiler Design IntroductionCompiler Design Introduction
Compiler Design IntroductionKuppusamy P
 
python presntation 2.pptx
python presntation 2.pptxpython presntation 2.pptx
python presntation 2.pptxArpittripathi45
 
Python as Web Development
Python as Web Development Python as Web Development
Python as Web Development SamWas1
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to pythonMohammed Rafi
 
4_5802928814682016556.pptx
4_5802928814682016556.pptx4_5802928814682016556.pptx
4_5802928814682016556.pptxAshenafiGirma5
 
Cd ch1 - introduction
Cd   ch1 - introductionCd   ch1 - introduction
Cd ch1 - introductionmengistu23
 
CD - CH1 - Introduction to compiler design.pptx
CD - CH1 - Introduction to compiler design.pptxCD - CH1 - Introduction to compiler design.pptx
CD - CH1 - Introduction to compiler design.pptxZiyadMohammed17
 
Compiler Design Basics
Compiler Design BasicsCompiler Design Basics
Compiler Design BasicsAkhil Kaushik
 
An Introduction To Python - Python, Print()
An Introduction To Python - Python, Print()An Introduction To Python - Python, Print()
An Introduction To Python - Python, Print()Blue Elephant Consulting
 
Introduction to Compilers
Introduction to CompilersIntroduction to Compilers
Introduction to CompilersAkhil Kaushik
 
Python programming language introduction unit
Python programming language introduction unitPython programming language introduction unit
Python programming language introduction unitmichaelaaron25322
 

Similaire à Introduction to Python Programming (20)

Python quick guide1
Python quick guide1Python quick guide1
Python quick guide1
 
Python programming 2nd
Python programming 2ndPython programming 2nd
Python programming 2nd
 
Introduction to Python Programming Basics
Introduction  to  Python  Programming BasicsIntroduction  to  Python  Programming Basics
Introduction to Python Programming Basics
 
Introduction to python history and platforms
Introduction to python history and platformsIntroduction to python history and platforms
Introduction to python history and platforms
 
computer languages
computer languagescomputer languages
computer languages
 
python intro and installation.pptx
python intro and installation.pptxpython intro and installation.pptx
python intro and installation.pptx
 
Python_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptxPython_Introduction_Good_PPT.pptx
Python_Introduction_Good_PPT.pptx
 
Compiler Design Introduction
Compiler Design IntroductionCompiler Design Introduction
Compiler Design Introduction
 
python presntation 2.pptx
python presntation 2.pptxpython presntation 2.pptx
python presntation 2.pptx
 
Python as Web Development
Python as Web Development Python as Web Development
Python as Web Development
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
4_5802928814682016556.pptx
4_5802928814682016556.pptx4_5802928814682016556.pptx
4_5802928814682016556.pptx
 
Cd ch1 - introduction
Cd   ch1 - introductionCd   ch1 - introduction
Cd ch1 - introduction
 
CD - CH1 - Introduction to compiler design.pptx
CD - CH1 - Introduction to compiler design.pptxCD - CH1 - Introduction to compiler design.pptx
CD - CH1 - Introduction to compiler design.pptx
 
Compiler Design Basics
Compiler Design BasicsCompiler Design Basics
Compiler Design Basics
 
An Introduction To Python - Python, Print()
An Introduction To Python - Python, Print()An Introduction To Python - Python, Print()
An Introduction To Python - Python, Print()
 
Python_slides.pdf
Python_slides.pdfPython_slides.pdf
Python_slides.pdf
 
Introduction to Compilers
Introduction to CompilersIntroduction to Compilers
Introduction to Compilers
 
MODULE 1.pptx
MODULE 1.pptxMODULE 1.pptx
MODULE 1.pptx
 
Python programming language introduction unit
Python programming language introduction unitPython programming language introduction unit
Python programming language introduction unit
 

Plus de Akhil Kaushik

Symbol Table, Error Handler & Code Generation
Symbol Table, Error Handler & Code GenerationSymbol Table, Error Handler & Code Generation
Symbol Table, Error Handler & Code GenerationAkhil Kaushik
 
Parsing in Compiler Design
Parsing in Compiler DesignParsing in Compiler Design
Parsing in Compiler DesignAkhil Kaushik
 
Context Free Grammar
Context Free GrammarContext Free Grammar
Context Free GrammarAkhil Kaushik
 
Error Detection & Recovery
Error Detection & RecoveryError Detection & Recovery
Error Detection & RecoveryAkhil Kaushik
 
Lexical Analyzer Implementation
Lexical Analyzer ImplementationLexical Analyzer Implementation
Lexical Analyzer ImplementationAkhil Kaushik
 
Lexical Analysis - Compiler Design
Lexical Analysis - Compiler DesignLexical Analysis - Compiler Design
Lexical Analysis - Compiler DesignAkhil Kaushik
 
File Handling Python
File Handling PythonFile Handling Python
File Handling PythonAkhil Kaushik
 
Algorithms & Complexity Calculation
Algorithms & Complexity CalculationAlgorithms & Complexity Calculation
Algorithms & Complexity CalculationAkhil Kaushik
 
Intro to Data Structure & Algorithms
Intro to Data Structure & AlgorithmsIntro to Data Structure & Algorithms
Intro to Data Structure & AlgorithmsAkhil Kaushik
 
Decision Making & Loops
Decision Making & LoopsDecision Making & Loops
Decision Making & LoopsAkhil Kaushik
 
Basic programs in Python
Basic programs in PythonBasic programs in Python
Basic programs in PythonAkhil Kaushik
 
Compiler Design Basics
Compiler Design BasicsCompiler Design Basics
Compiler Design BasicsAkhil Kaushik
 
Bootstrapping in Compiler
Bootstrapping in CompilerBootstrapping in Compiler
Bootstrapping in CompilerAkhil Kaushik
 
Compiler construction tools
Compiler construction toolsCompiler construction tools
Compiler construction toolsAkhil Kaushik
 

Plus de Akhil Kaushik (20)

Symbol Table, Error Handler & Code Generation
Symbol Table, Error Handler & Code GenerationSymbol Table, Error Handler & Code Generation
Symbol Table, Error Handler & Code Generation
 
Code Optimization
Code OptimizationCode Optimization
Code Optimization
 
Parsing in Compiler Design
Parsing in Compiler DesignParsing in Compiler Design
Parsing in Compiler Design
 
Context Free Grammar
Context Free GrammarContext Free Grammar
Context Free Grammar
 
Error Detection & Recovery
Error Detection & RecoveryError Detection & Recovery
Error Detection & Recovery
 
Symbol Table
Symbol TableSymbol Table
Symbol Table
 
Lexical Analyzer Implementation
Lexical Analyzer ImplementationLexical Analyzer Implementation
Lexical Analyzer Implementation
 
NFA & DFA
NFA & DFANFA & DFA
NFA & DFA
 
Lexical Analysis - Compiler Design
Lexical Analysis - Compiler DesignLexical Analysis - Compiler Design
Lexical Analysis - Compiler Design
 
File Handling Python
File Handling PythonFile Handling Python
File Handling Python
 
Regular Expressions
Regular ExpressionsRegular Expressions
Regular Expressions
 
Algorithms & Complexity Calculation
Algorithms & Complexity CalculationAlgorithms & Complexity Calculation
Algorithms & Complexity Calculation
 
Intro to Data Structure & Algorithms
Intro to Data Structure & AlgorithmsIntro to Data Structure & Algorithms
Intro to Data Structure & Algorithms
 
Decision Making & Loops
Decision Making & LoopsDecision Making & Loops
Decision Making & Loops
 
Basic programs in Python
Basic programs in PythonBasic programs in Python
Basic programs in Python
 
Python Data-Types
Python Data-TypesPython Data-Types
Python Data-Types
 
Compiler Design Basics
Compiler Design BasicsCompiler Design Basics
Compiler Design Basics
 
Bootstrapping in Compiler
Bootstrapping in CompilerBootstrapping in Compiler
Bootstrapping in Compiler
 
Compiler construction tools
Compiler construction toolsCompiler construction tools
Compiler construction tools
 
Phases of compiler
Phases of compilerPhases of compiler
Phases of compiler
 

Dernier

The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.MateoGardella
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Shubhangi Sonawane
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...KokoStevan
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 

Dernier (20)

The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 

Introduction to Python Programming

  • 1. Akhil Kaushik Asstt. Prof., CE Deptt., TIT Bhiwani Python Programming
  • 2. Python Introduction • Python is a popular programming language. • It was created by Guido van Rossum, and released in 1991. • Python source code is also available under the GNU General Public License (GPL).
  • 3. Python Introduction • Python is a general-purpose interpreted, interactive, object-oriented and high-level programming language. • Python is designed to be highly readable. • Python has a simple syntax similar to the English language.
  • 5. Type of Languages 1. Binary Level Language 2. Assembly Level Language 3. High Level Language
  • 6. Need for programming languages? • Closer to human thinking behavior. • Program’s size is shorter. • Error detection is easy. • Same program can be compiled in accordance to different machine architectures.
  • 7. History • Software for early computers were written in assembly language. • The need of reusability of code gave birth to programming languages. • This need grow huge to overcome the cost restriction of compiler.
  • 9. What is a Compiler?
  • 10. What is a Compiler? Source Language Target Language
  • 11. Translators - Interpreter • It is another common kind of language processor. • Instead of producing a target program as a translation, it directly execute the operations specified in the source program on inputs supplied by the user.
  • 12. Translators - Interpreter • This software converts the high-level language into low-level language line by line. • It takes less memory than compiler. • It takes more time than compiler. • It is more efficient in error detection than compiler. • It takes more time to build.
  • 13. Translators - Interpreter • Java language processors combine compilation and interpretation. • A Java source program may first be compiled into an intermediate form called bytecodes. • The bytecodes are then interpreted by a virtual machine. • A benefit of this arrangement is that bytecodes compiled on one machine can be interpreted on another machine, perhaps across a network.
  • 15. Translators - Assembler • This software converts the assembly language (assembly instruction mnemonics) into machine level language (opcodes i.e. 0,1). • It offers reusability of assembly codes on different machine platforms.
  • 16. Translators - Assembler • It generates instructions by evaluating the mnemonics (symbols) in operation field and find the value of symbol and literals to produce machine code. • Now, if assembler do all this work in one scan then it is called single pass assembler, otherwise if it does in multiple scans then called multiple pass assembler.
  • 17. Translators - Assembler • Pass-1: – Define symbols and literals and remember them in symbol table and literal table respectively. – Keep track of location counter – Process pseudo-operations • Pass-2: – Generate object code by converting symbolic op-code into respective numeric op-code – Generate data for literals and look for values of symbols
  • 19. Translators - Linker • A linker is a program that allows a user to link library programs or separate modules of code into their own programs. • It is used to combine different modules of object code into one single executable code program.
  • 20. Translators - Linker • This may involve combining a program with library programs, or involve recombining blocks of object code from the same program, or a mixture of both. • The linker program is used to recombine the blocks of object code in RAM to get a working full program. • Linker is helpful if there is a shortage of RAM.
  • 21. Translators - Loader • A loader is a piece of software that chooses exactly where to put object code in RAM, ready for it to be run. • It also adjusts the memory references in programs.
  • 22. Translators - Loader • Programs can be written by programmers using either ‘absolute addressing’ or ‘relative addressing’. • Relative addressing is more common because then the loader can put the program anywhere in RAM - absolute addressing isn't flexible. • Linker & Loader may overlap.
  • 24. Why Python? • It is used for: – web development (server-side applications), – software development (rapid prototyping), – handling big data and mathematics, – Connecting to database systems, – system scripting.
  • 25. Why Python? • It supports functional and object oriented programming. • It can be used as a scripting language or can be compiled to byte-code for building large applications. • It provides very high-level dynamic data types and supports dynamic type checking. • It supports automatic garbage collection.
  • 26. Why Python? • Python works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc). • Python has syntax that allows developers to write programs with fewer lines. • Python runs on an interpreter system, which makes prototyping very quick. • It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java.
  • 27. Why Python? • The current version is Python 3.8 • Earlier version – Python 2 is quite popular and has frequent security updates. • Some other versions of Python are 1.0, 1.5, 1.6, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7.
  • 28. Summary - Why Python? • Easy to learn, read and maintain • Broad standard library for all platforms. • Portable & extendable. • Interactive testing & debugging. • Support for all major databases. • Support for GUI applications.
  • 29. Summary - Why Python? • Python uses new lines to complete a command, instead of ; or {}. • Python relies on indentation, using whitespace, to define scope; such as the scope of loops, functions and classes.
  • 30. How to get started? • Usually, Python comes pre-installed in Windows, Linux and Mac OS. • To check, search in the start bar for Python or run the following on the Command Line (cmd.exe): C:UsersYour Name>python --version
  • 31. How to get started? • Else, we can download python from website: https://www.python.org/ • You can download Python documentation from: https://www.python.org/doc/ • The documentation is available in HTML, PDF, and PostScript formats.
  • 32. Steps to Install Python on Windows • Open a Web browser and go to https://www.python.org/downloads/. • Follow the link for the Windows installer python-XYZ.msi file where XYZ is the version you need to install. • Save the installer file to your local machine and then run it to find out if your machine supports MSI. • Run the downloaded file. This brings up the Python install wizard, which is really easy to use. Just accept the default settings, wait until the install is finished, and you are done.
  • 33. Steps to Install Python on Linux • Open a Web browser and go to https://www.python.org/downloads • Follow the link to download zipped source code available for Unix/Linux. • Download and extract files. • Editing the Modules/Setup file if you want to customize some options. • run ./configure script -> make -> make install • This installs Python at standard location /usr/local/bin and its libraries at /usr/local/lib/pythonXX where XX is the version of Python.
  • 34. Steps to Install Python on Macintosh • Recent Macs come with Python installed, but it may be several years out of date. • See http://www.python.org/download/mac/ for instructions on getting the current version along with extra tools to support development on the Mac.
  • 35. Setting up Path - Windows • To add the Python directory to the path for a particular session in Windows − • At the command prompt − type path -> Environment Variables -> path -> edit -> %path%;C:Python and press Enter. • Note − C:Python is the path of the Python directory
  • 36. Setting up Path - Linux • In the csh shell − type setenv PATH "$PATH:/usr/local/bin/python" and press Enter. • In the bash shell (Linux) − type export PATH="$PATH:/usr/local/bin/python" and press Enter. • In the sh or ksh shell − type PATH="$PATH:/usr/local/bin/python" and press Enter. • Note − /usr/local/bin/python is the path of the Python directory
  • 37. Running Python Code • Interactive Interpreter (write Python or IPython in command prompt) – C:> python • Script from the Command-line (write python code in an editor and save with .py extension, then call interpreter to run it) – C: >python script.py • Integrated Development Environment (IDE)
  • 38. Python IDEs • Jupyter • Spyder • Thonny • PyCharm • Komodo • NetBeans • &….so plethora of options…
  • 39. Jupyter Notebook • It is an open-source web application that allows you to create and share documents that may contain: – Data cleaning & transformation, – Equations & numerical simulation, – Data visualizations and narrative text. – Machine learning – Deep learning
  • 40. Jupyter Notebook • Project Jupyter is a non-profit, open-source project, born out of the IPython Project in 2014. • It supports over 40 languages. • It can also help us share notebooks. • It gives interactive output. • It also does big data integration.
  • 42. Let’s start writing code… • Download Anaconda from internet. • I have anaconda 4.4.0 (64-bit). • Write ‘Jupyter’ in the search box -> Jupyter Notebook. • It will start and a new tab will open in your default browser. • Click on “New” dropdown box -> Python3
  • 46. Keyboard shortcuts - Jupyter Notebook • Shift + Enter run the current cell, select below • Ctrl + Enter run selected cells • Alt + Enter run the current cell, insert below • Ctrl + S save and checkpoint • Ctrl + ] indent • Ctrl + [ dedent • H show all shortcuts • Z undo cell deletion • S Save and Checkpoint • A insert cell above • B insert cell below • X cut selected cells • C copy selected cells • V paste cells below • Shift + V paste cells above • Y change the cell type to Code • M change the cell type to Markdown
  • 48. Akhil Kaushik akhilkaushik05@gmail.com 9416910303 CONTACT ME AT: Akhil Kaushik akhilkaushik05@gmail.com 9416910303 THANK YOU !!!