SlideShare ist ein Scribd-Unternehmen logo
1 von 44
PYTHON FOR BEGINNERS
Introduction
 Python is a general purpose, high level programming
language that is often applied in scripting roles.
 so, python is programming language as well as
scripting language.
 Python is also called interpreted language.
9 March 2019Python
History
 Invented in Netherlands, early 90s by Guido van
Rossum
 Python was conceived in the late 1980s and its
implementation was started in December 1989
 Guido van Rossum is fan of ‘Monty Python’s Flying
Circus’, this is a famous TV show in Netherlands
 Named after Monty Python
 Open sourced from beginning
9 March 2019Python
Scope of Python
 Desktop application
 Web application
 Games
 Scientific application
 Artificial Intelligence (A.I.)
 Machine Learning (M.L)
 Data Science
 IoT (Internet of Things)
9 March 2019Python
What can I do with Python?
• System programming
• Graphical User Interface Programming
• Internet Scripting
• Component integration
• Database Programming
• Gaming, Images, XML, Robot and more
9 March 2019Python
Who uses Python TODAY…
• Python is being applied in real revenue-generating
products by real companies. For instance:
• Google is one of the Python users that included this
language in its web search system and employed Python’s
creator, too.
• YouTube video sharing service makes extensive use of
Python.
• ESRI uses Python as an end-user customization tool for its
popular GIS mapping products.
• iRobot uses Python to develop commercial robotic vacuum
cleaners.
• Intel, Cisco, Hewlett-Packard, Seagate, Qualcomm, and
IBM use Python for hardware testing.
9 March 2019Python
Features of Python
 Interpreted
 You run the program straight from the source code.
 Python program Bytecode a platforms native language
 You can just copy over your code to another system and it will
auto-magically work! *with python platform
 Object-Oriented
 Simple and additionally supports procedural programming
 Extensible – easily import other code
 Easy to read- Code is more clearly defined.
 Extensive libraries
 (i.e. reg. expressions, doc generation, CGI, ftp, web browsers,
ZIP, WAV, cryptography, etc...) (wxPython, Twisted, Python
Imaging library)
9 March 2019Python
Why do people use Python…?
 The following primary factors cited by Python
users seem to be these:
Python is object-oriented
 Structure supports such concepts as
polymorphism,operation overloading, and multiple
inheritance.
It's free (open source)
 Downloading and installing Python is free and
easy
 Source code is easily accessible.
9 March 2019Python
Python on your systems
 Its easy! Go to http://www.python.org/download/
 Download your architecture binary, or source
 Install, make, build whatever you need to do…
plenty of info on installation in readmes
 Make your first program! (a simple on like the hello
world one will do just fine)
 Two ways of running python code. Either in an
interpreter or in a file ran as an executable
Python
Starting IDLE on Windows
 Start IDLE
 Go to File menu and click on New Window
 Type your program in
 Go to File menu and click on Save. Type
in filename.py This will save it as a plain text
file, which can be opened in in any editor
you choose (like Notepad).
 To run your program go to Run and
click Run Module.
9 March 2019Python
Starting IDLE on Windows
9 March 2019Python
Python Shell
9 March 2019Python
How to open new file ?
9 March 2019Python
New file
9 March 2019Python
Continued…
9 March 2019Python
Continued…
9 March 2019Python
Continued…
9 March 2019Python
Continued…
9 March 2019Python
Python Code Execution
Source code you type is translated to byte code:
 Python Virtual Machine. Your code is automatically
compiled, but then it is interpreted.
 Source code extension is .py
 Byte code extension is .pyc (compiled python code)
9 March 2019Python
Basic Syntax of Python
 A Python identifier is a name used to identify a variable, function,
class, module or other object. An identifier starts with a letter A to Z
or a to z or an underscore (_) followed by zero or more letters,
underscores and digits (0 to 9).
 Python does not allow punctuation characters such as @, $, and
% within identifiers. Python is a case sensitive programming
language.
 Python provides no braces to indicate blocks of code for class and
function definitions or flow control. Blocks of code are denoted by
line indentation, which is rigidly enforced.
9 March 2019Python
Continued…
 Python accepts single ('), double (") and triple (''' or """) quotes to
denote string literals, as long as the same type of quote starts and
ends the string.
 A hash sign (#) that is not inside a string literal begins a comment.
9 March 2019Python
Standard Data types
 String – ‘MyString’, and “MyString”
 List – [ 69, 6.9, ‘mystring’, True]
 Tuple – (69, 6.9, ‘mystring’, True) immutable
 Set/frozenset – set([69, 6.9, ‘str’, True])
frozenset- ([69, 6.9, ‘str’, True]) –no duplicates &
unordered
 Dictionary or hash – {‘key 1’: 6.9, ‘key2’: False} -
group of key and value pairs
9 March 2019Python
Strings
 Strings in Python are identified as a contiguous set of
characters represented in the quotation marks.
Python allows for either pairs of single or double
quotes. Subsets of strings can be taken using the
slice operator ([ ] and [:] ) with indexes starting at 0 in
the beginning of the string and working their way from
-1 at the end.
 The plus (+) sign is the string concatenation operator
and the asterisk (*) is the repetition operator.
9 March 2019Python
Strings
9 March 2019Python
Lists
 lists are the most versatile of Python's compound data
types. A list contains items separated by commas and
enclosed within square brackets ([ ]). To some extent, lists
are similar to arrays in C. One difference between them is
that all the items belonging to a list can be of different data
type.
 The values stored in a list can be accessed using the slice
operator ([ ] and [:]) with indexes starting at 0 in the
beginning of the list and working their way to end -1. The
plus (+) sign is the list concatenation operator, and the
asterisk (*) is the repetition operator.
9 March 2019Python
Continued…
9 March 2019Python
Operators
There are various operators in Python
1. Arithmetic Operators
2. Relational Operators
3. Conditional Operators
4. Logical Operators
5. Bitwise Operators
6. Assignment Operators
7. Special operators
9 March 2019Python
Operators In Python
9 March 2019Python
CONDITIONAL STATEMENT
9 March 2019
Sr.No. Statement & Description
1. if statements An if statement consists of a boolean
expression followed by one or more statements.
2. if...else statements An if statement can be followed by an
optional else statement, which executes when the boolean
expression is FALSE.
3. nested if statements You can use one if or else if statement
inside another if or else if statement(s).
Continued…
9 March 2019Python
Loops
 A loop statement allows us to
execute a statement or group of
statements multiple times.
 Types of Loops:-
• While loop
• Do-while loop
• For loop
9 March 2019Python
Loops/ Iterations
9 March 2019Python
Functions
 A function is a block of organized, reusable
code that is used to perform a single, related
action. Functions provide better modularity
for your application and a high degree of
code reusing.
 As you already know, Python gives you
many built-in functions like print(), etc. but
you can also create your own functions.
These functions are called user-defined
functions.
9 March 2019Python
Defining a function
 You can define functions to provide the required
functionality. Here are simple rules to define a function in
Python.
 Function blocks begin with the keyword def followed by the
function name and parentheses ( ( ) ).
 Any input parameters or arguments should be placed within
these parentheses. You can also define parameters inside
these parentheses.
 The code block within every function starts with a colon (:)
and is indented.
 The statement return [expression] exits a function,
optionally passing back an expression to the caller. A return
statement with no arguments is the same as return None.
9 March 2019Python
Continued…
9 March 2019Python
Function with Description
1. cmp(list1, list2) Compares elements of both
lists.
2. len(list) Gives the total length of the list.
3. max(list) Returns item from the list with max
value.
4. min(list) Returns item from the list with min
value.
5. list(seq) Converts a tuple into list.
9 March 2019Python
Modules
 Modules refer to a file containing Python statements and
definitions.
 A file containing Python code, for e.g.: example.py is a module
and its module name would be example.
 We use modules to break down large programs into small
manageable and organized files. Furthermore, modules provide
reusability of code.
 We can define our most used functions in a module and import it,
instead of copying their definitions into different programs.
 Let us create a module. Type the following and save it as
example.py
9 March 2019Python
Import Statement
The properties of one module we can use into another
module by using 'import ' statement.
Python support two type of import statement
1. Normal import
2. From import
Normal import
In normal import entire python file or module object is
imported.
Whenever we import a module by using normal import we
can access the properties of that module by using that
module.
9 March 2019
How to import modules in Python?
9 March 2019Python
Continued...
From import
By using from import we can import the required
properties of module
 Module search path
• Cwd
• Environment variables
• Installation dependent directories
 if module is not found then we will get error
9 March 2019Python
Continued…
9 March 2019Python
1. Performance wise not up to the mark
because it is a interpreted
language.
2. Not using for mobile Application.
Limitations of Python
Software used
 Pycharm
 Python IDLE 3.7
 Pandas
 Anacondas
 Numpy
 Scpy
9 March 2019Python
9 March 2019Python

Weitere ähnliche Inhalte

Was ist angesagt?

PYTHON -Chapter 2 - Functions, Exception, Modules and Files -MAULIK BOR...
PYTHON -Chapter 2 - Functions,   Exception, Modules  and    Files -MAULIK BOR...PYTHON -Chapter 2 - Functions,   Exception, Modules  and    Files -MAULIK BOR...
PYTHON -Chapter 2 - Functions, Exception, Modules and Files -MAULIK BOR...
Maulik Borsaniya
 

Was ist angesagt? (20)

C Programming Homework Help
C Programming Homework HelpC Programming Homework Help
C Programming Homework Help
 
Chapter 1 Basic Programming (Python Programming Lecture)
Chapter 1 Basic Programming (Python Programming Lecture)Chapter 1 Basic Programming (Python Programming Lecture)
Chapter 1 Basic Programming (Python Programming Lecture)
 
Python basic
Python basicPython basic
Python basic
 
PYTHON -Chapter 2 - Functions, Exception, Modules and Files -MAULIK BOR...
PYTHON -Chapter 2 - Functions,   Exception, Modules  and    Files -MAULIK BOR...PYTHON -Chapter 2 - Functions,   Exception, Modules  and    Files -MAULIK BOR...
PYTHON -Chapter 2 - Functions, Exception, Modules and Files -MAULIK BOR...
 
Python intro ch_e_comp
Python intro ch_e_compPython intro ch_e_comp
Python intro ch_e_comp
 
Python Basics
Python Basics Python Basics
Python Basics
 
Python ppt
Python pptPython ppt
Python ppt
 
Python 培训讲义
Python 培训讲义Python 培训讲义
Python 培训讲义
 
python.ppt
python.pptpython.ppt
python.ppt
 
Functional programming in C++
Functional programming in C++Functional programming in C++
Functional programming in C++
 
Python advance
Python advancePython advance
Python advance
 
Python interview questions
Python interview questionsPython interview questions
Python interview questions
 
Zero to Hero - Introduction to Python3
Zero to Hero - Introduction to Python3Zero to Hero - Introduction to Python3
Zero to Hero - Introduction to Python3
 
Intro to Functions Python
Intro to Functions PythonIntro to Functions Python
Intro to Functions Python
 
Go programming introduction
Go programming introductionGo programming introduction
Go programming introduction
 
Python for loop
Python for loopPython for loop
Python for loop
 
Natural language processing open seminar For Tensorflow usage
Natural language processing open seminar For Tensorflow usageNatural language processing open seminar For Tensorflow usage
Natural language processing open seminar For Tensorflow usage
 
C pythontalk
C pythontalkC pythontalk
C pythontalk
 
NumPy
NumPyNumPy
NumPy
 
Python Homework Help
Python Homework HelpPython Homework Help
Python Homework Help
 

Ähnlich wie PYTHON FOR BEGINNERS (BASICS OF PYTHON)

Python Programming-1.pptx of python by computer
Python Programming-1.pptx of python by computerPython Programming-1.pptx of python by computer
Python Programming-1.pptx of python by computer
sharanyarashmir5
 
a9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptx
a9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptxa9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptx
a9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptx
cigogag569
 

Ähnlich wie PYTHON FOR BEGINNERS (BASICS OF PYTHON) (20)

Overview of python 2019
Overview of python 2019Overview of python 2019
Overview of python 2019
 
Chapter - 1.pptx
Chapter - 1.pptxChapter - 1.pptx
Chapter - 1.pptx
 
Python programming
Python programmingPython programming
Python programming
 
introduction of python in data science
introduction of python in data scienceintroduction of python in data science
introduction of python in data science
 
Python Programming-1.pptx of python by computer
Python Programming-1.pptx of python by computerPython Programming-1.pptx of python by computer
Python Programming-1.pptx of python by computer
 
python-handbook.pdf
python-handbook.pdfpython-handbook.pdf
python-handbook.pdf
 
Python final presentation kirti ppt1
Python final presentation kirti ppt1Python final presentation kirti ppt1
Python final presentation kirti ppt1
 
Core python programming tutorial
Core python programming tutorialCore python programming tutorial
Core python programming tutorial
 
Python - An Introduction
Python - An IntroductionPython - An Introduction
Python - An Introduction
 
Python Programmimg language in Gurugram
Python  Programmimg language in GurugramPython  Programmimg language in Gurugram
Python Programmimg language in Gurugram
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
 
Fundamentals of python
Fundamentals of pythonFundamentals of python
Fundamentals of python
 
python ppt | Python Course In Ghaziabad | Scode Network Institute
python ppt | Python Course In Ghaziabad | Scode Network Institutepython ppt | Python Course In Ghaziabad | Scode Network Institute
python ppt | Python Course In Ghaziabad | Scode Network Institute
 
Python unit1
Python unit1Python unit1
Python unit1
 
a9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptx
a9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptxa9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptx
a9855c3532e13484ee6a39ba30218896d7c0d863-1676987272842.pptx
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
 
Python fundamentals
Python fundamentalsPython fundamentals
Python fundamentals
 
Summer Training Project.pdf
Summer Training Project.pdfSummer Training Project.pdf
Summer Training Project.pdf
 
Python Course.docx
Python Course.docxPython Course.docx
Python Course.docx
 
What is Python.pptx
What is Python.pptxWhat is Python.pptx
What is Python.pptx
 

Mehr von HemaArora2

Mehr von HemaArora2 (13)

UNIT 4 SPM (DCRUST)
UNIT 4 SPM (DCRUST)UNIT 4 SPM (DCRUST)
UNIT 4 SPM (DCRUST)
 
UNIT 3 SPM
UNIT 3 SPMUNIT 3 SPM
UNIT 3 SPM
 
Spm previous year papers
Spm previous year papersSpm previous year papers
Spm previous year papers
 
WT(WEB TECHNOLOGY) previous year question papers
WT(WEB TECHNOLOGY) previous year question papersWT(WEB TECHNOLOGY) previous year question papers
WT(WEB TECHNOLOGY) previous year question papers
 
class 10 CBSE Chapter 5 Periodic classification of elements previous year imp...
class 10 CBSE Chapter 5 Periodic classification of elements previous year imp...class 10 CBSE Chapter 5 Periodic classification of elements previous year imp...
class 10 CBSE Chapter 5 Periodic classification of elements previous year imp...
 
Class 10 CBSE (Metals and non metals) chapter 3 previous year important quest...
Class 10 CBSE (Metals and non metals) chapter 3 previous year important quest...Class 10 CBSE (Metals and non metals) chapter 3 previous year important quest...
Class 10 CBSE (Metals and non metals) chapter 3 previous year important quest...
 
class 10 CBSE Chapter 2 Acids bases and salts important previous year questions
class 10 CBSE Chapter 2 Acids bases and salts important previous year questionsclass 10 CBSE Chapter 2 Acids bases and salts important previous year questions
class 10 CBSE Chapter 2 Acids bases and salts important previous year questions
 
UNIT 4 Software Testing Notes (Topic Wise)
UNIT 4 Software Testing Notes (Topic Wise)UNIT 4 Software Testing Notes (Topic Wise)
UNIT 4 Software Testing Notes (Topic Wise)
 
UNIT 3 Software Testing Notes (TOPIC WISE)
UNIT 3 Software Testing Notes (TOPIC WISE)UNIT 3 Software Testing Notes (TOPIC WISE)
UNIT 3 Software Testing Notes (TOPIC WISE)
 
UNIT 2 Software Testing (Topic Wise)
UNIT 2 Software Testing (Topic Wise)UNIT 2 Software Testing (Topic Wise)
UNIT 2 Software Testing (Topic Wise)
 
Unit 1 Software Testing (HANDWRITTEN+PRINTED NOTES)
Unit 1 Software Testing (HANDWRITTEN+PRINTED NOTES)Unit 1 Software Testing (HANDWRITTEN+PRINTED NOTES)
Unit 1 Software Testing (HANDWRITTEN+PRINTED NOTES)
 
UNIT 2 SPM (DCRUST)
UNIT 2 SPM (DCRUST)UNIT 2 SPM (DCRUST)
UNIT 2 SPM (DCRUST)
 
UNIT 1 SPM (DCRUST)
UNIT 1 SPM (DCRUST)UNIT 1 SPM (DCRUST)
UNIT 1 SPM (DCRUST)
 

Kürzlich hochgeladen

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Kürzlich hochgeladen (20)

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

PYTHON FOR BEGINNERS (BASICS OF PYTHON)

  • 2. Introduction  Python is a general purpose, high level programming language that is often applied in scripting roles.  so, python is programming language as well as scripting language.  Python is also called interpreted language. 9 March 2019Python
  • 3. History  Invented in Netherlands, early 90s by Guido van Rossum  Python was conceived in the late 1980s and its implementation was started in December 1989  Guido van Rossum is fan of ‘Monty Python’s Flying Circus’, this is a famous TV show in Netherlands  Named after Monty Python  Open sourced from beginning 9 March 2019Python
  • 4. Scope of Python  Desktop application  Web application  Games  Scientific application  Artificial Intelligence (A.I.)  Machine Learning (M.L)  Data Science  IoT (Internet of Things) 9 March 2019Python
  • 5. What can I do with Python? • System programming • Graphical User Interface Programming • Internet Scripting • Component integration • Database Programming • Gaming, Images, XML, Robot and more 9 March 2019Python
  • 6. Who uses Python TODAY… • Python is being applied in real revenue-generating products by real companies. For instance: • Google is one of the Python users that included this language in its web search system and employed Python’s creator, too. • YouTube video sharing service makes extensive use of Python. • ESRI uses Python as an end-user customization tool for its popular GIS mapping products. • iRobot uses Python to develop commercial robotic vacuum cleaners. • Intel, Cisco, Hewlett-Packard, Seagate, Qualcomm, and IBM use Python for hardware testing. 9 March 2019Python
  • 7. Features of Python  Interpreted  You run the program straight from the source code.  Python program Bytecode a platforms native language  You can just copy over your code to another system and it will auto-magically work! *with python platform  Object-Oriented  Simple and additionally supports procedural programming  Extensible – easily import other code  Easy to read- Code is more clearly defined.  Extensive libraries  (i.e. reg. expressions, doc generation, CGI, ftp, web browsers, ZIP, WAV, cryptography, etc...) (wxPython, Twisted, Python Imaging library) 9 March 2019Python
  • 8. Why do people use Python…?  The following primary factors cited by Python users seem to be these: Python is object-oriented  Structure supports such concepts as polymorphism,operation overloading, and multiple inheritance. It's free (open source)  Downloading and installing Python is free and easy  Source code is easily accessible. 9 March 2019Python
  • 9. Python on your systems  Its easy! Go to http://www.python.org/download/  Download your architecture binary, or source  Install, make, build whatever you need to do… plenty of info on installation in readmes  Make your first program! (a simple on like the hello world one will do just fine)  Two ways of running python code. Either in an interpreter or in a file ran as an executable Python
  • 10. Starting IDLE on Windows  Start IDLE  Go to File menu and click on New Window  Type your program in  Go to File menu and click on Save. Type in filename.py This will save it as a plain text file, which can be opened in in any editor you choose (like Notepad).  To run your program go to Run and click Run Module. 9 March 2019Python
  • 11. Starting IDLE on Windows 9 March 2019Python
  • 12. Python Shell 9 March 2019Python
  • 13. How to open new file ? 9 March 2019Python
  • 14. New file 9 March 2019Python
  • 19. Python Code Execution Source code you type is translated to byte code:  Python Virtual Machine. Your code is automatically compiled, but then it is interpreted.  Source code extension is .py  Byte code extension is .pyc (compiled python code) 9 March 2019Python
  • 20. Basic Syntax of Python  A Python identifier is a name used to identify a variable, function, class, module or other object. An identifier starts with a letter A to Z or a to z or an underscore (_) followed by zero or more letters, underscores and digits (0 to 9).  Python does not allow punctuation characters such as @, $, and % within identifiers. Python is a case sensitive programming language.  Python provides no braces to indicate blocks of code for class and function definitions or flow control. Blocks of code are denoted by line indentation, which is rigidly enforced. 9 March 2019Python
  • 21. Continued…  Python accepts single ('), double (") and triple (''' or """) quotes to denote string literals, as long as the same type of quote starts and ends the string.  A hash sign (#) that is not inside a string literal begins a comment. 9 March 2019Python
  • 22. Standard Data types  String – ‘MyString’, and “MyString”  List – [ 69, 6.9, ‘mystring’, True]  Tuple – (69, 6.9, ‘mystring’, True) immutable  Set/frozenset – set([69, 6.9, ‘str’, True]) frozenset- ([69, 6.9, ‘str’, True]) –no duplicates & unordered  Dictionary or hash – {‘key 1’: 6.9, ‘key2’: False} - group of key and value pairs 9 March 2019Python
  • 23. Strings  Strings in Python are identified as a contiguous set of characters represented in the quotation marks. Python allows for either pairs of single or double quotes. Subsets of strings can be taken using the slice operator ([ ] and [:] ) with indexes starting at 0 in the beginning of the string and working their way from -1 at the end.  The plus (+) sign is the string concatenation operator and the asterisk (*) is the repetition operator. 9 March 2019Python
  • 25. Lists  lists are the most versatile of Python's compound data types. A list contains items separated by commas and enclosed within square brackets ([ ]). To some extent, lists are similar to arrays in C. One difference between them is that all the items belonging to a list can be of different data type.  The values stored in a list can be accessed using the slice operator ([ ] and [:]) with indexes starting at 0 in the beginning of the list and working their way to end -1. The plus (+) sign is the list concatenation operator, and the asterisk (*) is the repetition operator. 9 March 2019Python
  • 27. Operators There are various operators in Python 1. Arithmetic Operators 2. Relational Operators 3. Conditional Operators 4. Logical Operators 5. Bitwise Operators 6. Assignment Operators 7. Special operators 9 March 2019Python
  • 28. Operators In Python 9 March 2019Python
  • 29. CONDITIONAL STATEMENT 9 March 2019 Sr.No. Statement & Description 1. if statements An if statement consists of a boolean expression followed by one or more statements. 2. if...else statements An if statement can be followed by an optional else statement, which executes when the boolean expression is FALSE. 3. nested if statements You can use one if or else if statement inside another if or else if statement(s).
  • 31. Loops  A loop statement allows us to execute a statement or group of statements multiple times.  Types of Loops:- • While loop • Do-while loop • For loop 9 March 2019Python
  • 33. Functions  A function is a block of organized, reusable code that is used to perform a single, related action. Functions provide better modularity for your application and a high degree of code reusing.  As you already know, Python gives you many built-in functions like print(), etc. but you can also create your own functions. These functions are called user-defined functions. 9 March 2019Python
  • 34. Defining a function  You can define functions to provide the required functionality. Here are simple rules to define a function in Python.  Function blocks begin with the keyword def followed by the function name and parentheses ( ( ) ).  Any input parameters or arguments should be placed within these parentheses. You can also define parameters inside these parentheses.  The code block within every function starts with a colon (:) and is indented.  The statement return [expression] exits a function, optionally passing back an expression to the caller. A return statement with no arguments is the same as return None. 9 March 2019Python
  • 36. Function with Description 1. cmp(list1, list2) Compares elements of both lists. 2. len(list) Gives the total length of the list. 3. max(list) Returns item from the list with max value. 4. min(list) Returns item from the list with min value. 5. list(seq) Converts a tuple into list. 9 March 2019Python
  • 37. Modules  Modules refer to a file containing Python statements and definitions.  A file containing Python code, for e.g.: example.py is a module and its module name would be example.  We use modules to break down large programs into small manageable and organized files. Furthermore, modules provide reusability of code.  We can define our most used functions in a module and import it, instead of copying their definitions into different programs.  Let us create a module. Type the following and save it as example.py 9 March 2019Python
  • 38. Import Statement The properties of one module we can use into another module by using 'import ' statement. Python support two type of import statement 1. Normal import 2. From import Normal import In normal import entire python file or module object is imported. Whenever we import a module by using normal import we can access the properties of that module by using that module. 9 March 2019
  • 39. How to import modules in Python? 9 March 2019Python
  • 40. Continued... From import By using from import we can import the required properties of module  Module search path • Cwd • Environment variables • Installation dependent directories  if module is not found then we will get error 9 March 2019Python
  • 42. 1. Performance wise not up to the mark because it is a interpreted language. 2. Not using for mobile Application. Limitations of Python
  • 43. Software used  Pycharm  Python IDLE 3.7  Pandas  Anacondas  Numpy  Scpy 9 March 2019Python