SlideShare a Scribd company logo
Introducing the Python
Interpreter
The Python interpreter is the core component that executes Python
code, whether in interactive mode or through script files. It provides a
powerful and flexible platform for developers to write, test, and run
their programs.
SS
by Shashikant Sathe
Starting the Python
Interpreter
1 Interactive Mode
The Python interpreter can
be started in interactive
mode, allowing you to
execute commands and see
immediate results.
2 Script Execution
Python programs can also
be saved as script files and
executed directly by the
interpreter.
3 Command Line
The interpreter can be launched from the command line,
providing a quick and convenient way to start coding.
Executing Python Programs
Interactive Execution
In interactive mode, each statement
is executed immediately, and the
results are displayed on the console.
Script Execution
When running a Python script, the
interpreter executes the entire
program from start to finish,
producing the final output.
Debugging
The interpreter provides tools and
features to help developers debug
their code, such as breakpoints and
step-by-step execution.
Interactive vs. Script
Execution
Interactive Mode
Ideal for quick testing,
experimenting, and exploring
the language. Allows
immediate feedback and
exploration.
Script Execution
Better for developing and
running larger, more complex
programs. Scripts can be
easily shared, version
controlled, and executed
repeatedly.
Combination
Developers often use a combination of interactive mode and script
execution, depending on the task at hand.
The Execution Model
1
Source Code
Python code is written in the .py file format, containing high-level,
human-readable statements.
2
Bytecode Generation
The interpreter converts the source code into a lower-level,
machine-readable bytecode representation.
3
Execution
The interpreter then executes the bytecode, performing the
instructions and producing the final output.
The Python Interpreter Workflow
Input
The interpreter receives the Python code, either from an interactive
session or a script file.
Parsing
The code is parsed and validated, ensuring it follows the Python syntax
rules.
Bytecode Generation
The validated code is then transformed into a lower-level bytecode
representation.
Execution
The bytecode is executed by the interpreter, which performs the
necessary operations and produces the output.
Interpretation vs. Compilation
Interpreted Languages
Python is an interpreted language,
where the interpreter executes the
code line by line, without a separate
compilation step.
Compiled Languages
Compiled languages, such as C or
Java, go through a separate
compilation step to generate
machine-executable code.
Differences
Interpreted languages are generally
more flexible and easier to use, while
compiled languages can offer better
performance.
Execution Model Variations
CPython The standard Python implementation, which uses an
interpreter to execute the bytecode.
Jython A Python implementation that runs on the Java Virtual
Machine (JVM).
PyPy A Python implementation that uses just-in-time (JIT)
compilation for improved performance.
Just-In-Time (JIT) Compilation
1 Source Code
The Python source code is first converted to bytecode, just like
in the standard interpreter.
2 JIT Compilation
The JIT compiler analyzes the bytecode and generates
optimized machine code on-the-fly.
3 Execution
The optimized machine code is then executed, providing a
significant performance boost over the standard interpreter.
Conclusion: Python's
Execution Options
1 Flexibility
Python offers a variety of
execution models, allowing
developers to choose the
one that best fits their
needs.
2 Performance
Innovations like JIT
compilation can
significantly improve the
performance of Python
programs.
3 Ecosystem
The Python community has developed a rich ecosystem of tools
and implementations to enhance the language's capabilities.
Ad

Recommended

1-ppt-python.ppt
1-ppt-python.ppt
ssusera99a83
 
Python for students step by step guidance
Python for students step by step guidance
MantoshKumar79
 
Python Interpreter.pdf
Python Interpreter.pdf
SudhanshiBakre1
 
Introduction to Python Unit -1 Part .pdf
Introduction to Python Unit -1 Part .pdf
VaibhavKumarSinghkal
 
Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.
Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.
Niraj Bharambe
 
session5-Getting stated with Python.pdf
session5-Getting stated with Python.pdf
AyushDutta32
 
python-ppt.ppt
python-ppt.ppt
MohammadSamiuddin10
 
python-ppt.ppt
python-ppt.ppt
MohammadSamiuddin10
 
1.python interpreter and interactive mode
1.python interpreter and interactive mode
ManjuA8
 
Welcome_to_Python.pptx
Welcome_to_Python.pptx
21M220KARTHIKEYANC
 
PYTHON FEATURES.pptx
PYTHON FEATURES.pptx
MaheShiva
 
Unit 1-Part-1-Introduction to Python.pdf
Unit 1-Part-1-Introduction to Python.pdf
Harsha Patil
 
Python Introduction
Python Introduction
Learnbay Datascience
 
Python Mastery: A Comprehensive Guide to Setting Up Your Development Environment
Python Mastery: A Comprehensive Guide to Setting Up Your Development Environment
Python Devloper
 
Introduction to Python.pptx Introduction to Python.pptx
Introduction to Python.pptx Introduction to Python.pptx
trwdcn
 
Python Tutorial | Python Programming Language
Python Tutorial | Python Programming Language
anaveenkumar4
 
Introduction to python for Beginners
Introduction to python for Beginners
Sujith Kumar
 
Python Programming Draft PPT.pptx
Python Programming Draft PPT.pptx
LakshmiNarayanaReddy48
 
Python tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academy
TIB Academy
 
Session-1_Introduction to Python.pptx
Session-1_Introduction to Python.pptx
WajidAliHashmi2
 
Py-Slides-1.pptPy-Slides-1.pptPy-Slides-1.pptPy-Slides-1.ppt
Py-Slides-1.pptPy-Slides-1.pptPy-Slides-1.pptPy-Slides-1.ppt
v65176016
 
intro.pptx (1).pdf
intro.pptx (1).pdf
ANIKULSAIKH
 
Chapter 2: Basics of programming pyton programming
Chapter 2: Basics of programming pyton programming
biniyamtiktok
 
Py-Slides-1.ppt1234444444444444444444444444444444444444444
Py-Slides-1.ppt1234444444444444444444444444444444444444444
divijareddy0502
 
program on python what is python where it was started by whom started
program on python what is python where it was started by whom started
rajkumarmandal9391
 
Python slides for the beginners to learn
Python slides for the beginners to learn
krishna43511
 
Python Over View (Python for mobile app Devt)1.ppt
Python Over View (Python for mobile app Devt)1.ppt
AbdurehmanDawud
 
Python Training in Pune - Ethans Tech Pune
Python Training in Pune - Ethans Tech Pune
Ethan's Tech
 
Civil Engineering Departmental PPT 1.pptx
Civil Engineering Departmental PPT 1.pptx
SHASHIKANT346021
 
Electronics and Computer Engineering PPT.pptx
Electronics and Computer Engineering PPT.pptx
SHASHIKANT346021
 

More Related Content

Similar to Introducing-the-Python-Interpreter. What is Python Interpreter (20)

1.python interpreter and interactive mode
1.python interpreter and interactive mode
ManjuA8
 
Welcome_to_Python.pptx
Welcome_to_Python.pptx
21M220KARTHIKEYANC
 
PYTHON FEATURES.pptx
PYTHON FEATURES.pptx
MaheShiva
 
Unit 1-Part-1-Introduction to Python.pdf
Unit 1-Part-1-Introduction to Python.pdf
Harsha Patil
 
Python Introduction
Python Introduction
Learnbay Datascience
 
Python Mastery: A Comprehensive Guide to Setting Up Your Development Environment
Python Mastery: A Comprehensive Guide to Setting Up Your Development Environment
Python Devloper
 
Introduction to Python.pptx Introduction to Python.pptx
Introduction to Python.pptx Introduction to Python.pptx
trwdcn
 
Python Tutorial | Python Programming Language
Python Tutorial | Python Programming Language
anaveenkumar4
 
Introduction to python for Beginners
Introduction to python for Beginners
Sujith Kumar
 
Python Programming Draft PPT.pptx
Python Programming Draft PPT.pptx
LakshmiNarayanaReddy48
 
Python tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academy
TIB Academy
 
Session-1_Introduction to Python.pptx
Session-1_Introduction to Python.pptx
WajidAliHashmi2
 
Py-Slides-1.pptPy-Slides-1.pptPy-Slides-1.pptPy-Slides-1.ppt
Py-Slides-1.pptPy-Slides-1.pptPy-Slides-1.pptPy-Slides-1.ppt
v65176016
 
intro.pptx (1).pdf
intro.pptx (1).pdf
ANIKULSAIKH
 
Chapter 2: Basics of programming pyton programming
Chapter 2: Basics of programming pyton programming
biniyamtiktok
 
Py-Slides-1.ppt1234444444444444444444444444444444444444444
Py-Slides-1.ppt1234444444444444444444444444444444444444444
divijareddy0502
 
program on python what is python where it was started by whom started
program on python what is python where it was started by whom started
rajkumarmandal9391
 
Python slides for the beginners to learn
Python slides for the beginners to learn
krishna43511
 
Python Over View (Python for mobile app Devt)1.ppt
Python Over View (Python for mobile app Devt)1.ppt
AbdurehmanDawud
 
Python Training in Pune - Ethans Tech Pune
Python Training in Pune - Ethans Tech Pune
Ethan's Tech
 
1.python interpreter and interactive mode
1.python interpreter and interactive mode
ManjuA8
 
PYTHON FEATURES.pptx
PYTHON FEATURES.pptx
MaheShiva
 
Unit 1-Part-1-Introduction to Python.pdf
Unit 1-Part-1-Introduction to Python.pdf
Harsha Patil
 
Python Mastery: A Comprehensive Guide to Setting Up Your Development Environment
Python Mastery: A Comprehensive Guide to Setting Up Your Development Environment
Python Devloper
 
Introduction to Python.pptx Introduction to Python.pptx
Introduction to Python.pptx Introduction to Python.pptx
trwdcn
 
Python Tutorial | Python Programming Language
Python Tutorial | Python Programming Language
anaveenkumar4
 
Introduction to python for Beginners
Introduction to python for Beginners
Sujith Kumar
 
Python tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academy
TIB Academy
 
Session-1_Introduction to Python.pptx
Session-1_Introduction to Python.pptx
WajidAliHashmi2
 
Py-Slides-1.pptPy-Slides-1.pptPy-Slides-1.pptPy-Slides-1.ppt
Py-Slides-1.pptPy-Slides-1.pptPy-Slides-1.pptPy-Slides-1.ppt
v65176016
 
intro.pptx (1).pdf
intro.pptx (1).pdf
ANIKULSAIKH
 
Chapter 2: Basics of programming pyton programming
Chapter 2: Basics of programming pyton programming
biniyamtiktok
 
Py-Slides-1.ppt1234444444444444444444444444444444444444444
Py-Slides-1.ppt1234444444444444444444444444444444444444444
divijareddy0502
 
program on python what is python where it was started by whom started
program on python what is python where it was started by whom started
rajkumarmandal9391
 
Python slides for the beginners to learn
Python slides for the beginners to learn
krishna43511
 
Python Over View (Python for mobile app Devt)1.ppt
Python Over View (Python for mobile app Devt)1.ppt
AbdurehmanDawud
 
Python Training in Pune - Ethans Tech Pune
Python Training in Pune - Ethans Tech Pune
Ethan's Tech
 

More from SHASHIKANT346021 (8)

Civil Engineering Departmental PPT 1.pptx
Civil Engineering Departmental PPT 1.pptx
SHASHIKANT346021
 
Electronics and Computer Engineering PPT.pptx
Electronics and Computer Engineering PPT.pptx
SHASHIKANT346021
 
Course Presentation: Electronic & Computer Engineering
Course Presentation: Electronic & Computer Engineering
SHASHIKANT346021
 
Parallel Programming Models: Shared variable model, Message passing model, Da...
Parallel Programming Models: Shared variable model, Message passing model, Da...
SHASHIKANT346021
 
Parallel Programming Models: Shared variable model
Parallel Programming Models: Shared variable model
SHASHIKANT346021
 
LECTURE 6 DESIGN, DEBUGGING, INTERFACES.pdf
LECTURE 6 DESIGN, DEBUGGING, INTERFACES.pdf
SHASHIKANT346021
 
Classes in Java great learning.pdf
Classes in Java great learning.pdf
SHASHIKANT346021
 
LECTURE 3 LOOPS, ARRAYS.pdf
LECTURE 3 LOOPS, ARRAYS.pdf
SHASHIKANT346021
 
Civil Engineering Departmental PPT 1.pptx
Civil Engineering Departmental PPT 1.pptx
SHASHIKANT346021
 
Electronics and Computer Engineering PPT.pptx
Electronics and Computer Engineering PPT.pptx
SHASHIKANT346021
 
Course Presentation: Electronic & Computer Engineering
Course Presentation: Electronic & Computer Engineering
SHASHIKANT346021
 
Parallel Programming Models: Shared variable model, Message passing model, Da...
Parallel Programming Models: Shared variable model, Message passing model, Da...
SHASHIKANT346021
 
Parallel Programming Models: Shared variable model
Parallel Programming Models: Shared variable model
SHASHIKANT346021
 
LECTURE 6 DESIGN, DEBUGGING, INTERFACES.pdf
LECTURE 6 DESIGN, DEBUGGING, INTERFACES.pdf
SHASHIKANT346021
 
Classes in Java great learning.pdf
Classes in Java great learning.pdf
SHASHIKANT346021
 
LECTURE 3 LOOPS, ARRAYS.pdf
LECTURE 3 LOOPS, ARRAYS.pdf
SHASHIKANT346021
 
Ad

Recently uploaded (20)

20CE404-Soil Mechanics - Slide Share PPT
20CE404-Soil Mechanics - Slide Share PPT
saravananr808639
 
CST413 KTU S7 CSE Machine Learning Clustering K Means Hierarchical Agglomerat...
CST413 KTU S7 CSE Machine Learning Clustering K Means Hierarchical Agglomerat...
resming1
 
May 2025: Top 10 Read Articles in Data Mining & Knowledge Management Process
May 2025: Top 10 Read Articles in Data Mining & Knowledge Management Process
IJDKP
 
Kel.3_A_Review_on_Internet_of_Things_for_Defense_v3.pptx
Kel.3_A_Review_on_Internet_of_Things_for_Defense_v3.pptx
Endang Saefullah
 
NEW Strengthened Senior High School Gen Math.pptx
NEW Strengthened Senior High School Gen Math.pptx
DaryllWhere
 
Abraham Silberschatz-Operating System Concepts (9th,2012.12).pdf
Abraham Silberschatz-Operating System Concepts (9th,2012.12).pdf
Shabista Imam
 
Data Structures Module 3 Binary Trees Binary Search Trees Tree Traversals AVL...
Data Structures Module 3 Binary Trees Binary Search Trees Tree Traversals AVL...
resming1
 
Industry 4.o the fourth revolutionWeek-2.pptx
Industry 4.o the fourth revolutionWeek-2.pptx
KNaveenKumarECE
 
Rapid Prototyping for XR: Lecture 5 - Cross Platform Development
Rapid Prototyping for XR: Lecture 5 - Cross Platform Development
Mark Billinghurst
 
special_edition_using_visual_foxpro_6.pdf
special_edition_using_visual_foxpro_6.pdf
Shabista Imam
 
FUNDAMENTALS OF COMPUTER ORGANIZATION AND ARCHITECTURE
FUNDAMENTALS OF COMPUTER ORGANIZATION AND ARCHITECTURE
Shabista Imam
 
Complete University of Calculus :: 2nd edition
Complete University of Calculus :: 2nd edition
Shabista Imam
 
retina_biometrics ruet rajshahi bangdesh.pptx
retina_biometrics ruet rajshahi bangdesh.pptx
MdRakibulIslam697135
 
Comparison of Flexible and Rigid Pavements in Bangladesh
Comparison of Flexible and Rigid Pavements in Bangladesh
Arifur Rahman
 
Bitumen Emulsion by Dr Sangita Ex CRRI Delhi
Bitumen Emulsion by Dr Sangita Ex CRRI Delhi
grilcodes
 
Complete guidance book of Asp.Net Web API
Complete guidance book of Asp.Net Web API
Shabista Imam
 
Rapid Prototyping for XR: Lecture 2 - Low Fidelity Prototyping.
Rapid Prototyping for XR: Lecture 2 - Low Fidelity Prototyping.
Mark Billinghurst
 
MATERIAL SCIENCE LECTURE NOTES FOR DIPLOMA STUDENTS
MATERIAL SCIENCE LECTURE NOTES FOR DIPLOMA STUDENTS
SAMEER VISHWAKARMA
 
دراسة حاله لقرية تقع في جنوب غرب السودان
دراسة حاله لقرية تقع في جنوب غرب السودان
محمد قصص فتوتة
 
Rapid Prototyping for XR: Lecture 4 - High Level Prototyping.
Rapid Prototyping for XR: Lecture 4 - High Level Prototyping.
Mark Billinghurst
 
20CE404-Soil Mechanics - Slide Share PPT
20CE404-Soil Mechanics - Slide Share PPT
saravananr808639
 
CST413 KTU S7 CSE Machine Learning Clustering K Means Hierarchical Agglomerat...
CST413 KTU S7 CSE Machine Learning Clustering K Means Hierarchical Agglomerat...
resming1
 
May 2025: Top 10 Read Articles in Data Mining & Knowledge Management Process
May 2025: Top 10 Read Articles in Data Mining & Knowledge Management Process
IJDKP
 
Kel.3_A_Review_on_Internet_of_Things_for_Defense_v3.pptx
Kel.3_A_Review_on_Internet_of_Things_for_Defense_v3.pptx
Endang Saefullah
 
NEW Strengthened Senior High School Gen Math.pptx
NEW Strengthened Senior High School Gen Math.pptx
DaryllWhere
 
Abraham Silberschatz-Operating System Concepts (9th,2012.12).pdf
Abraham Silberschatz-Operating System Concepts (9th,2012.12).pdf
Shabista Imam
 
Data Structures Module 3 Binary Trees Binary Search Trees Tree Traversals AVL...
Data Structures Module 3 Binary Trees Binary Search Trees Tree Traversals AVL...
resming1
 
Industry 4.o the fourth revolutionWeek-2.pptx
Industry 4.o the fourth revolutionWeek-2.pptx
KNaveenKumarECE
 
Rapid Prototyping for XR: Lecture 5 - Cross Platform Development
Rapid Prototyping for XR: Lecture 5 - Cross Platform Development
Mark Billinghurst
 
special_edition_using_visual_foxpro_6.pdf
special_edition_using_visual_foxpro_6.pdf
Shabista Imam
 
FUNDAMENTALS OF COMPUTER ORGANIZATION AND ARCHITECTURE
FUNDAMENTALS OF COMPUTER ORGANIZATION AND ARCHITECTURE
Shabista Imam
 
Complete University of Calculus :: 2nd edition
Complete University of Calculus :: 2nd edition
Shabista Imam
 
retina_biometrics ruet rajshahi bangdesh.pptx
retina_biometrics ruet rajshahi bangdesh.pptx
MdRakibulIslam697135
 
Comparison of Flexible and Rigid Pavements in Bangladesh
Comparison of Flexible and Rigid Pavements in Bangladesh
Arifur Rahman
 
Bitumen Emulsion by Dr Sangita Ex CRRI Delhi
Bitumen Emulsion by Dr Sangita Ex CRRI Delhi
grilcodes
 
Complete guidance book of Asp.Net Web API
Complete guidance book of Asp.Net Web API
Shabista Imam
 
Rapid Prototyping for XR: Lecture 2 - Low Fidelity Prototyping.
Rapid Prototyping for XR: Lecture 2 - Low Fidelity Prototyping.
Mark Billinghurst
 
MATERIAL SCIENCE LECTURE NOTES FOR DIPLOMA STUDENTS
MATERIAL SCIENCE LECTURE NOTES FOR DIPLOMA STUDENTS
SAMEER VISHWAKARMA
 
دراسة حاله لقرية تقع في جنوب غرب السودان
دراسة حاله لقرية تقع في جنوب غرب السودان
محمد قصص فتوتة
 
Rapid Prototyping for XR: Lecture 4 - High Level Prototyping.
Rapid Prototyping for XR: Lecture 4 - High Level Prototyping.
Mark Billinghurst
 
Ad

Introducing-the-Python-Interpreter. What is Python Interpreter

  • 1. Introducing the Python Interpreter The Python interpreter is the core component that executes Python code, whether in interactive mode or through script files. It provides a powerful and flexible platform for developers to write, test, and run their programs. SS by Shashikant Sathe
  • 2. Starting the Python Interpreter 1 Interactive Mode The Python interpreter can be started in interactive mode, allowing you to execute commands and see immediate results. 2 Script Execution Python programs can also be saved as script files and executed directly by the interpreter. 3 Command Line The interpreter can be launched from the command line, providing a quick and convenient way to start coding.
  • 3. Executing Python Programs Interactive Execution In interactive mode, each statement is executed immediately, and the results are displayed on the console. Script Execution When running a Python script, the interpreter executes the entire program from start to finish, producing the final output. Debugging The interpreter provides tools and features to help developers debug their code, such as breakpoints and step-by-step execution.
  • 4. Interactive vs. Script Execution Interactive Mode Ideal for quick testing, experimenting, and exploring the language. Allows immediate feedback and exploration. Script Execution Better for developing and running larger, more complex programs. Scripts can be easily shared, version controlled, and executed repeatedly. Combination Developers often use a combination of interactive mode and script execution, depending on the task at hand.
  • 5. The Execution Model 1 Source Code Python code is written in the .py file format, containing high-level, human-readable statements. 2 Bytecode Generation The interpreter converts the source code into a lower-level, machine-readable bytecode representation. 3 Execution The interpreter then executes the bytecode, performing the instructions and producing the final output.
  • 6. The Python Interpreter Workflow Input The interpreter receives the Python code, either from an interactive session or a script file. Parsing The code is parsed and validated, ensuring it follows the Python syntax rules. Bytecode Generation The validated code is then transformed into a lower-level bytecode representation. Execution The bytecode is executed by the interpreter, which performs the necessary operations and produces the output.
  • 7. Interpretation vs. Compilation Interpreted Languages Python is an interpreted language, where the interpreter executes the code line by line, without a separate compilation step. Compiled Languages Compiled languages, such as C or Java, go through a separate compilation step to generate machine-executable code. Differences Interpreted languages are generally more flexible and easier to use, while compiled languages can offer better performance.
  • 8. Execution Model Variations CPython The standard Python implementation, which uses an interpreter to execute the bytecode. Jython A Python implementation that runs on the Java Virtual Machine (JVM). PyPy A Python implementation that uses just-in-time (JIT) compilation for improved performance.
  • 9. Just-In-Time (JIT) Compilation 1 Source Code The Python source code is first converted to bytecode, just like in the standard interpreter. 2 JIT Compilation The JIT compiler analyzes the bytecode and generates optimized machine code on-the-fly. 3 Execution The optimized machine code is then executed, providing a significant performance boost over the standard interpreter.
  • 10. Conclusion: Python's Execution Options 1 Flexibility Python offers a variety of execution models, allowing developers to choose the one that best fits their needs. 2 Performance Innovations like JIT compilation can significantly improve the performance of Python programs. 3 Ecosystem The Python community has developed a rich ecosystem of tools and implementations to enhance the language's capabilities.