SlideShare a Scribd company logo
1 of 36
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 - 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

Similar to Python PPT1.pdf

WEB PROGRAMMING UNIT VIII BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT VIII BY BHAVSINGH MALOTHWEB PROGRAMMING UNIT VIII BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT VIII BY BHAVSINGH MALOTHBhavsingh Maloth
 
a9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptx
a9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptxa9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptx
a9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptxcigogag569
 
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.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
 
Web Programming UNIT VIII notes
Web Programming UNIT VIII notesWeb Programming UNIT VIII notes
Web Programming UNIT VIII notesBhavsingh Maloth
 
Python final presentation kirti ppt1
Python final presentation kirti ppt1Python final presentation kirti ppt1
Python final presentation kirti ppt1Kirti Verma
 
Python Tutorial | Python Programming Language
Python Tutorial | Python Programming LanguagePython Tutorial | Python Programming Language
Python Tutorial | Python Programming Languageanaveenkumar4
 
Introduction to python for Beginners
Introduction to python for Beginners Introduction to python for Beginners
Introduction to python for Beginners Sujith Kumar
 
Introduction to Python Unit -1 Part .pdf
Introduction to Python Unit -1 Part .pdfIntroduction to Python Unit -1 Part .pdf
Introduction to Python Unit -1 Part .pdfVaibhavKumarSinghkal
 
Python Programming | JNTUK | UNIT 1 | Lecture 3
Python Programming | JNTUK | UNIT 1 | Lecture 3Python Programming | JNTUK | UNIT 1 | Lecture 3
Python Programming | JNTUK | UNIT 1 | Lecture 3FabMinds
 
Python_final_print_vison_academy_9822506209.pdf
Python_final_print_vison_academy_9822506209.pdfPython_final_print_vison_academy_9822506209.pdf
Python_final_print_vison_academy_9822506209.pdfVisionAcademyProfSac
 
intro.pptx (1).pdf
intro.pptx (1).pdfintro.pptx (1).pdf
intro.pptx (1).pdfANIKULSAIKH
 
introduction of python in data science
introduction of python in data scienceintroduction of python in data science
introduction of python in data sciencebhavesh lande
 
BASIC_INTRODUCTION_TO_PYTHON_PROGRAMMING.pdf
BASIC_INTRODUCTION_TO_PYTHON_PROGRAMMING.pdfBASIC_INTRODUCTION_TO_PYTHON_PROGRAMMING.pdf
BASIC_INTRODUCTION_TO_PYTHON_PROGRAMMING.pdfashaks17
 
Python tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academyPython tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academyTIB Academy
 

Similar to Python PPT1.pdf (20)

WEB PROGRAMMING UNIT VIII BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT VIII BY BHAVSINGH MALOTHWEB PROGRAMMING UNIT VIII BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT VIII BY BHAVSINGH MALOTH
 
a9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptx
a9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptxa9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptx
a9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptx
 
python-ppt.ppt
python-ppt.pptpython-ppt.ppt
python-ppt.ppt
 
python-ppt.ppt
python-ppt.pptpython-ppt.ppt
python-ppt.ppt
 
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.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.
 
Web Programming UNIT VIII notes
Web Programming UNIT VIII notesWeb Programming UNIT VIII notes
Web Programming UNIT VIII notes
 
Chapter - 1.pptx
Chapter - 1.pptxChapter - 1.pptx
Chapter - 1.pptx
 
Python final presentation kirti ppt1
Python final presentation kirti ppt1Python final presentation kirti ppt1
Python final presentation kirti ppt1
 
Introduction python
Introduction pythonIntroduction python
Introduction python
 
Python Tutorial | Python Programming Language
Python Tutorial | Python Programming LanguagePython Tutorial | Python Programming Language
Python Tutorial | Python Programming Language
 
Introduction to python for Beginners
Introduction to python for Beginners Introduction to python for Beginners
Introduction to python for Beginners
 
Introduction to Python Unit -1 Part .pdf
Introduction to Python Unit -1 Part .pdfIntroduction to Python Unit -1 Part .pdf
Introduction to Python Unit -1 Part .pdf
 
Python Programming | JNTUK | UNIT 1 | Lecture 3
Python Programming | JNTUK | UNIT 1 | Lecture 3Python Programming | JNTUK | UNIT 1 | Lecture 3
Python Programming | JNTUK | UNIT 1 | Lecture 3
 
Python_final_print_vison_academy_9822506209.pdf
Python_final_print_vison_academy_9822506209.pdfPython_final_print_vison_academy_9822506209.pdf
Python_final_print_vison_academy_9822506209.pdf
 
intro.pptx (1).pdf
intro.pptx (1).pdfintro.pptx (1).pdf
intro.pptx (1).pdf
 
introduction of python in data science
introduction of python in data scienceintroduction of python in data science
introduction of python in data science
 
BASIC_INTRODUCTION_TO_PYTHON_PROGRAMMING.pdf
BASIC_INTRODUCTION_TO_PYTHON_PROGRAMMING.pdfBASIC_INTRODUCTION_TO_PYTHON_PROGRAMMING.pdf
BASIC_INTRODUCTION_TO_PYTHON_PROGRAMMING.pdf
 
PYTHON PROGRAMMING NOTES RKREDDY.pdf
PYTHON PROGRAMMING NOTES RKREDDY.pdfPYTHON PROGRAMMING NOTES RKREDDY.pdf
PYTHON PROGRAMMING NOTES RKREDDY.pdf
 
kecs105.pdf
kecs105.pdfkecs105.pdf
kecs105.pdf
 
Python tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academyPython tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academy
 

Recently uploaded

(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).pptssuser5c9d4b1
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
High Profile Call Girls Dahisar Arpita 9907093804 Independent Escort Service ...
High Profile Call Girls Dahisar Arpita 9907093804 Independent Escort Service ...High Profile Call Girls Dahisar Arpita 9907093804 Independent Escort Service ...
High Profile Call Girls Dahisar Arpita 9907093804 Independent Escort Service ...Call girls in Ahmedabad High profile
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 

Recently uploaded (20)

(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
High Profile Call Girls Dahisar Arpita 9907093804 Independent Escort Service ...
High Profile Call Girls Dahisar Arpita 9907093804 Independent Escort Service ...High Profile Call Girls Dahisar Arpita 9907093804 Independent Escort Service ...
High Profile Call Girls Dahisar Arpita 9907093804 Independent Escort Service ...
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 

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
  • 3.
  • 4.
  • 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.