SlideShare a Scribd company logo
INTRODUCTION
TO
PYTHON
Dr. S. SELVAKANMANI,
ASSOCIATE PROFESSOR,
DEPARTMENT OF CSE,
VELAMMAL I TECH
AGENDA
 Companies using Python
 Top languages for Data Science
 Introduction to Python & Features
 Installation of Python
 Working in IDLE
 Working in Jupyter Notebook
 Interactive Vs Script Mode
Python PPT1.pdf
Python PPT1.pdf
PYTHON - INTRODUCTION
 Developed in late 1980 by Guido Van Rossum at National
Research Institute for Mathematics and Computer Science
in Netherlands.
Features of Python:
 Simple – It is simple to learn, read and write
 High level language – Program codes contains easy to
read syntax that is later converted into a low level language
(i.e binary codes)
PYTHON – INTRODUCTION Contd..
 Open Source – It is freely available and the source code is
available for free.
 Cross Platform/Portable - Python can run equally on
different platforms such as Windows, Linux, Unix, and
Macintosh etc.
 Interpreted Language – Python program written will be
converted into intermediate language which is again
translated into native or machine language for execution.
PYTHON – INTRODUCTION Contd..
PYTHON – INTRODUCTION Contd..
 Interpreter translates just one statement of the program at
a time into machine code.
Vs
 Compiler scans the entire program and translates the
whole of it into machine code at once.
PYTHON – INTRODUCTION Contd..
 Case – Sensitive Language – Difference between
Uppercase and lowercase letters. i.e area, Area.
 Object Oriented Language - Python structures a
program by bundling related properties and behaviors into
individual objects.
 Automatic Type Inference – Doesn‟t need to define the type
of the data during its declaration.
PYTHON – INTRODUCTION Contd..
 Scripting language – Uses an Interpreter to translate its
source code. The interpreter reads and executes each line of
code one at a time (like a “script” in a play/audition)
 No worry about memory allocation
 Interface with existing programming language –
Comes with a large standard library that supports many
common tasks.
 No Semicolon at the end of the statement
PYTHON – INSTALLATION
 Downloads available in www.python.org (Known as Cpython
Installation and it comes with Python Interpreter , Python IDLE
and PIP ( Package Installer )
 Other Python distributions available in Anaconda Python
distribution (https://www.anaconda.com/distribution/),
comes with preloaded packages such as NumPy , SciPy, Pandas
etc .
 Other Popular downloads available in form of Spyder IDE ,
PyCharm IDE etc.. (https://www.guru99.com/python-ide-code-
editor.html)
PYTHON – WORKING IN IDLE
 IDLE – Integrated Development and Learning Environment
 Two modes of working : (i) Interactive mode and (ii) Script
mode
 Interactive Mode : Writing & Executing one command at
a time. ( Click Start – All Programs – Python x.x –IDLE )
 Type the commands in the prompt (>>>) and hit Enter to
see the output.
PYTHON – INTERACTIVE MODE
>>> - Chevron
PYTHON – WORKING IN IDLE
 Script Mode : Writing & Executing Programs.
 (Click Start – All Programs – Python x.x – IDLE )
 ( Click File – New – in Python IDLE shell )
 Type the commands in the newly opened window and save the
program with the extension (.py )
 For Execution , Click Run – Run Module or Press F5.
PYTHON – SCRIPT MODE
PYTHON – FEATURES OF IDLE
 Multi-window text editor with syntax highlighting.
 Auto completion with smart indentation.
 Python shell to display output with syntax highlighting.
PYTHON – WORKING IN JUPYTER NOTEBOOK
 Launch Anaconda Navigator from Start – All Programs –
Anaconda –Anaconda Navigator .
 Click on Launch JUPYTER Notebook (Opens in Web
Browser)
 Select Python3 by clicking on the drop down arrow mark of
New Option placed on the right hand side of the Dashboard.
 JUPYTER = JUlia, PYThon and R
PYTHON – JUPYTER NOTEBOOK
PYTHON – WORKING IN JUPYTER NOTEBOOK
 In this window, the code can be written within the cell
provided.
 If using Interactive mode, Type the commands in the Cell
and Press Run or Shift Enter.
 If using Script mode, Type the commands in the Cell , save
the file by clicking on Untitled1 , Click Run to run your
program
PYTHON – JUPYTER NOTEBOOK
PYTHON – INTERACTIVE Vs SCRIPT MODE
PYTHON – VIRTUAL ENVIRONMENT
https://repl.it
colab.research.google.com
https://www.codechef.com/ide
https://pynative.com/online-python-code-
editor-to-execute-python-code/
https://www.jdoodle.com/python3-
programming-online/
PYTHON – SYNTAX
 Keywords – Set of predefined words. A prescribed rule of
usage for each keyword is called a syntax.
 Python 3.x interpreter has 33 keywords defined in it.
 Since they have a predefined meaning attached, they cannot
be used for any other purpose.
 To know the list of python keywords:
>>>help('keywords')
PYTHON – LIST OF KEYWORDS : 33 nos.
PYTHON – SYNTAX
 Apart from Keywords, Python program can have variables,
functions, classes, modules, packages etc.
 Identifier is the name given to these programming elements.
 An identifier should start with either an alphabet letter (lower or
upper case) or an underscore (_).
 After that, more than one alphabet letters (a-z or A-Z), digits (0-
9) or underscores may be used to form an identifier.
 No other characters are allowed such as @,#,$, etc
 Identifiers are case – sensitive.
PYTHON – SYNTAX
 Eg: Names like myClass, var_1, and
this_is_a_long_variable
PYTHON – STATEMENT
 By default, the Python interpreter treats a piece of text
terminated by hard carriage return (i.e new line character) as one
statement.
 It means each line in a Python script is a statement.
 (Just as in C/C++/C#, a semicolon ; denotes the end of a
statement).
 Eg1: msg="Hello World"
 Eg2: code=123
 Eg3: name="Steve"
Use the semicolon ; to write multiple
statements in a single line.
Eg:
msg='"Hello World";code=123;name="Steve"'
PYTHON – STATEMENT
Continuation of Statement: We can show the text spread over
more than one lines to be a single statement by using the
backslash () as a continuation character.
 Eg:
msg="Hello Python Learners  <enter>
Welcome to Python Tutorial  <enter>
from CSE Department"
PYTHON – INDENTS
 Many times it is required to construct a block of more than one
statements.
 For example there might be multiple statements that are part of
the definition of a function or method.
 Most of the programming languages like C, C++, Java use braces
{ } to define a block of code. But, python uses indentation.
 Blocks of code are denoted by line indentation.
 It is a space given to the block of codes for class and
function definitions or flow control.
PYTHON – INDENTS
 When a block is to be started, type the colon symbol (:) and
press Enter.
 Any Python-aware editor (like IDLE) goes to the next line
leaving an additional whitespace (called indent).
 Subsequent statements in the block follow the same level of
indent.
PYTHON – COMMENTS
 A hash sign (#) is the beginning of a comment.
 Anything written after # in a line is ignored by interpreter.
 Eg: percentage = (minute * 100) / 60 # calculating
percentage of an hour
 Python does not have multiple-line commenting feature. You
have to comment each line individually as follows :
# this is a comment
print ("Hello World")
print ("Welcome to Python Tutorial") #this is also a comment but after a statement
Use triple – quote
for mutli – line
comment
PYTHON – INPUT AND OUTPUT
 Input is data entered by user (end user) in the program.
 In python, input () function is available for input.
 Syntax is:
variable = input (“data”)
 Eg:
>>> x=input("enter the name:")
enter the name: George
>>>y=int(input("enter the number"))
 enter the number 3
Python accepts string as default data type. Conversion is required for type.
A function is a block of
code which only runs
when it is called.
A set of statements
which perform a
specific tasks.
PYTHON – INPUT AND OUTPUT
 OUTPUT: Output can be displayed to the user using print
statement .
 Syntax:
print (expression/constant/variable)
 Example:
>>> print ("Hello")
Hello
PYTHON – VARIABLE
 Any value of certain type is stored in the computer's memory for
processing.
 Out of available memory locations, one is randomly allocated for
storage.
 In order to conveniently and repeatedly refer to the stored value,
it is given a suitable name.
 A value is bound to a name by the assignment operator '='.
 Eg:
A = 3
PYTHON – VARIABLE
Eg:
A = 3
 A is the identifier and 3 is the value assigned to it.
 The same identifier can be used to refer to another value.
Eg:
A = „hello‟
 So, the value being referred can change (or vary), hence it is
called a variable.
 It is important to remember that a variable is a name given
to a value, and not to a memory location storing the value.
THANK
YOU

More Related Content

PPTX
Exploratory Data Analysis
PDF
Python final ppt
PDF
Python libraries
PPTX
PYTHON FEATURES.pptx
PDF
Python - the basics
PPTX
11 Unit1 Chapter 1 Getting Started With Python
PPTX
File Handling Python
PPTX
Digital data
Exploratory Data Analysis
Python final ppt
Python libraries
PYTHON FEATURES.pptx
Python - the basics
11 Unit1 Chapter 1 Getting Started With Python
File Handling Python
Digital data

What's hot (20)

PDF
Disease Detection in Plant Leaves using K-Means Clustering and Neural Network
PPTX
MatplotLib.pptx
PDF
Data Visualization in Python
PPTX
Modules in Python Programming
PPTX
Full Python in 20 slides
PDF
Python Anaconda Tutorial | Edureka
PDF
Python File Handling | File Operations in Python | Learn python programming |...
PPTX
Python programming introduction
PDF
Set methods in python
PPTX
Variables in python
PPTX
Conditional and control statement
PDF
Strings in python
PPTX
Deep belief network.pptx
PDF
Python Crash Course
PPTX
Python Data Structures and Algorithms.pptx
PPTX
Trends in DM.pptx
PPSX
Modules and packages in python
PDF
Python NumPy Tutorial | NumPy Array | Edureka
PPTX
Naive Bayes
Disease Detection in Plant Leaves using K-Means Clustering and Neural Network
MatplotLib.pptx
Data Visualization in Python
Modules in Python Programming
Full Python in 20 slides
Python Anaconda Tutorial | Edureka
Python File Handling | File Operations in Python | Learn python programming |...
Python programming introduction
Set methods in python
Variables in python
Conditional and control statement
Strings in python
Deep belief network.pptx
Python Crash Course
Python Data Structures and Algorithms.pptx
Trends in DM.pptx
Modules and packages in python
Python NumPy Tutorial | NumPy Array | Edureka
Naive Bayes
Ad

Similar to Python PPT1.pdf (20)

PPT
program on python what is python where it was started by whom started
PPT
Python Over View (Python for mobile app Devt)1.ppt
PPT
Py-Slides-1.ppt1234444444444444444444444444444444444444444
PPT
Python slides for the beginners to learn
PPT
Py-Slides-1.pptPy-Slides-1.pptPy-Slides-1.pptPy-Slides-1.ppt
PDF
Py-Slides- easuajsjsjejejjwlqpqpqpp1.pdf
PPT
notwa dfdfvs gf fdgfgh s thgfgh frg reggg
PDF
Python Programing Bio computing,basic concepts lab,,
PDF
PYTHON PROGRAMMING NOTES RKREDDY.pdf
PPTX
Python programming lanuguage
PDF
Unit 1-Part-1-Introduction to Python.pdf
PDF
Python (3).pdf
PDF
Computer Related material named Phython ok
PPTX
a9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptx
PDF
Fundamentals of python
PPTX
Introduction to Python Programming .pptx
PDF
Introduction to Python Unit -1 Part .pdf
PDF
problem solving and python programming UNIT 2.pdf
PDF
Problem Solving and Python Programming UNIT 2.pdf
PDF
GE3151_PSPP_UNIT_2_Notes
program on python what is python where it was started by whom started
Python Over View (Python for mobile app Devt)1.ppt
Py-Slides-1.ppt1234444444444444444444444444444444444444444
Python slides for the beginners to learn
Py-Slides-1.pptPy-Slides-1.pptPy-Slides-1.pptPy-Slides-1.ppt
Py-Slides- easuajsjsjejejjwlqpqpqpp1.pdf
notwa dfdfvs gf fdgfgh s thgfgh frg reggg
Python Programing Bio computing,basic concepts lab,,
PYTHON PROGRAMMING NOTES RKREDDY.pdf
Python programming lanuguage
Unit 1-Part-1-Introduction to Python.pdf
Python (3).pdf
Computer Related material named Phython ok
a9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptx
Fundamentals of python
Introduction to Python Programming .pptx
Introduction to Python Unit -1 Part .pdf
problem solving and python programming UNIT 2.pdf
Problem Solving and Python Programming UNIT 2.pdf
GE3151_PSPP_UNIT_2_Notes
Ad

Recently uploaded (20)

PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
Internet of Things (IOT) - A guide to understanding
PPTX
web development for engineering and engineering
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PDF
PPT on Performance Review to get promotions
PPTX
OOP with Java - Java Introduction (Basics)
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
Lecture Notes Electrical Wiring System Components
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
DOCX
573137875-Attendance-Management-System-original
PPTX
Welding lecture in detail for understanding
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
Foundation to blockchain - A guide to Blockchain Tech
bas. eng. economics group 4 presentation 1.pptx
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
CYBER-CRIMES AND SECURITY A guide to understanding
Internet of Things (IOT) - A guide to understanding
web development for engineering and engineering
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Operating System & Kernel Study Guide-1 - converted.pdf
PPT on Performance Review to get promotions
OOP with Java - Java Introduction (Basics)
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Lecture Notes Electrical Wiring System Components
Model Code of Practice - Construction Work - 21102022 .pdf
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
573137875-Attendance-Management-System-original
Welding lecture in detail for understanding

Python PPT1.pdf

  • 1. INTRODUCTION TO PYTHON Dr. S. SELVAKANMANI, ASSOCIATE PROFESSOR, DEPARTMENT OF CSE, VELAMMAL I TECH
  • 2. AGENDA  Companies using Python  Top languages for Data Science  Introduction to Python & Features  Installation of Python  Working in IDLE  Working in Jupyter Notebook  Interactive Vs Script Mode
  • 5. PYTHON - INTRODUCTION  Developed in late 1980 by Guido Van Rossum at National Research Institute for Mathematics and Computer Science in Netherlands. Features of Python:  Simple – It is simple to learn, read and write  High level language – Program codes contains easy to read syntax that is later converted into a low level language (i.e binary codes)
  • 6. PYTHON – INTRODUCTION Contd..  Open Source – It is freely available and the source code is available for free.  Cross Platform/Portable - Python can run equally on different platforms such as Windows, Linux, Unix, and Macintosh etc.  Interpreted Language – Python program written will be converted into intermediate language which is again translated into native or machine language for execution.
  • 8. PYTHON – INTRODUCTION Contd..  Interpreter translates just one statement of the program at a time into machine code. Vs  Compiler scans the entire program and translates the whole of it into machine code at once.
  • 9. PYTHON – INTRODUCTION Contd..  Case – Sensitive Language – Difference between Uppercase and lowercase letters. i.e area, Area.  Object Oriented Language - Python structures a program by bundling related properties and behaviors into individual objects.  Automatic Type Inference – Doesn‟t need to define the type of the data during its declaration.
  • 10. PYTHON – INTRODUCTION Contd..  Scripting language – Uses an Interpreter to translate its source code. The interpreter reads and executes each line of code one at a time (like a “script” in a play/audition)  No worry about memory allocation  Interface with existing programming language – Comes with a large standard library that supports many common tasks.  No Semicolon at the end of the statement
  • 11. PYTHON – INSTALLATION  Downloads available in www.python.org (Known as Cpython Installation and it comes with Python Interpreter , Python IDLE and PIP ( Package Installer )  Other Python distributions available in Anaconda Python distribution (https://www.anaconda.com/distribution/), comes with preloaded packages such as NumPy , SciPy, Pandas etc .  Other Popular downloads available in form of Spyder IDE , PyCharm IDE etc.. (https://www.guru99.com/python-ide-code- editor.html)
  • 12. PYTHON – WORKING IN IDLE  IDLE – Integrated Development and Learning Environment  Two modes of working : (i) Interactive mode and (ii) Script mode  Interactive Mode : Writing & Executing one command at a time. ( Click Start – All Programs – Python x.x –IDLE )  Type the commands in the prompt (>>>) and hit Enter to see the output.
  • 13. PYTHON – INTERACTIVE MODE >>> - Chevron
  • 14. PYTHON – WORKING IN IDLE  Script Mode : Writing & Executing Programs.  (Click Start – All Programs – Python x.x – IDLE )  ( Click File – New – in Python IDLE shell )  Type the commands in the newly opened window and save the program with the extension (.py )  For Execution , Click Run – Run Module or Press F5.
  • 16. PYTHON – FEATURES OF IDLE  Multi-window text editor with syntax highlighting.  Auto completion with smart indentation.  Python shell to display output with syntax highlighting.
  • 17. PYTHON – WORKING IN JUPYTER NOTEBOOK  Launch Anaconda Navigator from Start – All Programs – Anaconda –Anaconda Navigator .  Click on Launch JUPYTER Notebook (Opens in Web Browser)  Select Python3 by clicking on the drop down arrow mark of New Option placed on the right hand side of the Dashboard.  JUPYTER = JUlia, PYThon and R
  • 18. PYTHON – JUPYTER NOTEBOOK
  • 19. PYTHON – WORKING IN JUPYTER NOTEBOOK  In this window, the code can be written within the cell provided.  If using Interactive mode, Type the commands in the Cell and Press Run or Shift Enter.  If using Script mode, Type the commands in the Cell , save the file by clicking on Untitled1 , Click Run to run your program
  • 20. PYTHON – JUPYTER NOTEBOOK
  • 21. PYTHON – INTERACTIVE Vs SCRIPT MODE
  • 22. PYTHON – VIRTUAL ENVIRONMENT https://repl.it colab.research.google.com https://www.codechef.com/ide https://pynative.com/online-python-code- editor-to-execute-python-code/ https://www.jdoodle.com/python3- programming-online/
  • 23. PYTHON – SYNTAX  Keywords – Set of predefined words. A prescribed rule of usage for each keyword is called a syntax.  Python 3.x interpreter has 33 keywords defined in it.  Since they have a predefined meaning attached, they cannot be used for any other purpose.  To know the list of python keywords: >>>help('keywords')
  • 24. PYTHON – LIST OF KEYWORDS : 33 nos.
  • 25. PYTHON – SYNTAX  Apart from Keywords, Python program can have variables, functions, classes, modules, packages etc.  Identifier is the name given to these programming elements.  An identifier should start with either an alphabet letter (lower or upper case) or an underscore (_).  After that, more than one alphabet letters (a-z or A-Z), digits (0- 9) or underscores may be used to form an identifier.  No other characters are allowed such as @,#,$, etc  Identifiers are case – sensitive.
  • 26. PYTHON – SYNTAX  Eg: Names like myClass, var_1, and this_is_a_long_variable
  • 27. PYTHON – STATEMENT  By default, the Python interpreter treats a piece of text terminated by hard carriage return (i.e new line character) as one statement.  It means each line in a Python script is a statement.  (Just as in C/C++/C#, a semicolon ; denotes the end of a statement).  Eg1: msg="Hello World"  Eg2: code=123  Eg3: name="Steve" Use the semicolon ; to write multiple statements in a single line. Eg: msg='"Hello World";code=123;name="Steve"'
  • 28. PYTHON – STATEMENT Continuation of Statement: We can show the text spread over more than one lines to be a single statement by using the backslash () as a continuation character.  Eg: msg="Hello Python Learners <enter> Welcome to Python Tutorial <enter> from CSE Department"
  • 29. PYTHON – INDENTS  Many times it is required to construct a block of more than one statements.  For example there might be multiple statements that are part of the definition of a function or method.  Most of the programming languages like C, C++, Java use braces { } to define a block of code. But, python uses indentation.  Blocks of code are denoted by line indentation.  It is a space given to the block of codes for class and function definitions or flow control.
  • 30. PYTHON – INDENTS  When a block is to be started, type the colon symbol (:) and press Enter.  Any Python-aware editor (like IDLE) goes to the next line leaving an additional whitespace (called indent).  Subsequent statements in the block follow the same level of indent.
  • 31. PYTHON – COMMENTS  A hash sign (#) is the beginning of a comment.  Anything written after # in a line is ignored by interpreter.  Eg: percentage = (minute * 100) / 60 # calculating percentage of an hour  Python does not have multiple-line commenting feature. You have to comment each line individually as follows : # this is a comment print ("Hello World") print ("Welcome to Python Tutorial") #this is also a comment but after a statement Use triple – quote for mutli – line comment
  • 32. PYTHON – INPUT AND OUTPUT  Input is data entered by user (end user) in the program.  In python, input () function is available for input.  Syntax is: variable = input (“data”)  Eg: >>> x=input("enter the name:") enter the name: George >>>y=int(input("enter the number"))  enter the number 3 Python accepts string as default data type. Conversion is required for type. A function is a block of code which only runs when it is called. A set of statements which perform a specific tasks.
  • 33. PYTHON – INPUT AND OUTPUT  OUTPUT: Output can be displayed to the user using print statement .  Syntax: print (expression/constant/variable)  Example: >>> print ("Hello") Hello
  • 34. PYTHON – VARIABLE  Any value of certain type is stored in the computer's memory for processing.  Out of available memory locations, one is randomly allocated for storage.  In order to conveniently and repeatedly refer to the stored value, it is given a suitable name.  A value is bound to a name by the assignment operator '='.  Eg: A = 3
  • 35. PYTHON – VARIABLE Eg: A = 3  A is the identifier and 3 is the value assigned to it.  The same identifier can be used to refer to another value. Eg: A = „hello‟  So, the value being referred can change (or vary), hence it is called a variable.  It is important to remember that a variable is a name given to a value, and not to a memory location storing the value.