SlideShare uma empresa Scribd logo
1 de 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 !!!

Mais conteúdo relacionado

Mais procurados

Presentation on python
Presentation on pythonPresentation on python
Presentation on pythonwilliam john
 
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
 
Introduction to python programming
Introduction to python programmingIntroduction to python programming
Introduction to python programmingSrinivas Narasegouda
 
Introduction to Python
Introduction to Python Introduction to Python
Introduction to Python amiable_indian
 
Conditional and control statement
Conditional and control statementConditional and control statement
Conditional and control statementnarmadhakin
 
Variables & Data Types In Python | Edureka
Variables & Data Types In Python | EdurekaVariables & Data Types In Python | Edureka
Variables & Data Types In Python | EdurekaEdureka!
 
Installing Anaconda Distribution of Python
Installing Anaconda Distribution of PythonInstalling Anaconda Distribution of Python
Installing Anaconda Distribution of PythonJatin Miglani
 
Overview of python 2019
Overview of python 2019Overview of python 2019
Overview of python 2019Samir Mohanty
 
1.python interpreter and interactive mode
1.python interpreter and interactive mode1.python interpreter and interactive mode
1.python interpreter and interactive modeManjuA8
 
Python File Handling | File Operations in Python | Learn python programming |...
Python File Handling | File Operations in Python | Learn python programming |...Python File Handling | File Operations in Python | Learn python programming |...
Python File Handling | File Operations in Python | Learn python programming |...Edureka!
 

Mais procurados (20)

Presentation on python
Presentation on pythonPresentation on python
Presentation on python
 
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 Tutorial Part 1
Python Tutorial Part 1Python Tutorial Part 1
Python Tutorial Part 1
 
Introduction to python programming
Introduction to python programmingIntroduction to python programming
Introduction to python programming
 
Python
PythonPython
Python
 
Introduction to Python
Introduction to Python Introduction to Python
Introduction to Python
 
Conditional and control statement
Conditional and control statementConditional and control statement
Conditional and control statement
 
Variables & Data Types In Python | Edureka
Variables & Data Types In Python | EdurekaVariables & Data Types In Python | Edureka
Variables & Data Types In Python | Edureka
 
Python programming
Python  programmingPython  programming
Python programming
 
Installing Anaconda Distribution of Python
Installing Anaconda Distribution of PythonInstalling Anaconda Distribution of Python
Installing Anaconda Distribution of Python
 
Basics of python
Basics of pythonBasics of python
Basics of python
 
Python final ppt
Python final pptPython final ppt
Python final ppt
 
Python basic
Python basicPython basic
Python basic
 
Overview of python 2019
Overview of python 2019Overview of python 2019
Overview of python 2019
 
Python by Rj
Python by RjPython by Rj
Python by Rj
 
1.python interpreter and interactive mode
1.python interpreter and interactive mode1.python interpreter and interactive mode
1.python interpreter and interactive mode
 
Python File Handling | File Operations in Python | Learn python programming |...
Python File Handling | File Operations in Python | Learn python programming |...Python File Handling | File Operations in Python | Learn python programming |...
Python File Handling | File Operations in Python | Learn python programming |...
 
Programming with Python
Programming with PythonProgramming with Python
Programming with Python
 
Python
PythonPython
Python
 
Python ppt
Python pptPython ppt
Python ppt
 

Semelhante a 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
 

Semelhante a 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
 

Mais 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
 

Mais 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
 

Último

Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
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
 
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
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
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
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 

Último (20)

Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
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
 
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
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).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.
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 

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 !!!