際際滷

際際滷Share a Scribd company logo
PYTHON PROGRAMMING
BY
CH SRILAKSHMI PRASANNA
INTRODUCTION TO PYTHON
 Object-oriented programming language
 Guido van Rossum in 1989.
 National Research Institute for Mathematics and Computer Science
 Netherlands
 The comedy group Monty Python.
FEATURES OF PYTHON
 Versatile
 High Level programming
 Extensible
 Easy maintenance
 Robust
 Multi threaded
 Garbage collection
 Secure
APPLICATIONS OF PYTHON
 Build a website
 Develop a game
 Perform Computer Vision (Facilities like face-detection and color-detection)
 Implement Machine Learning (Give a computer the ability to learn)
 Enable Robotics with Python
 Perform Web Scraping (Harvest data from websites)
 Perform Data Analysis using Python
 Automate a web browser
 Perform Scripting in Python
 Perform Scientific Computing using Python
 Build Artificial Intelligence
APPLICATIONS OF PYTHON
 brands like YouTube, Dropbox, and Netflix
 Search-engine Google
VARIABLES AND IDENTIFIERS
 X=20
 Names starts with letters, numbers, underscores.
DATA TYPES
 Variables can hold values of different types called data types.
 Assigning or Initializing values of variables:
MULTIPLE ASSIGNMENT
 Allows to assign a single value to
More than one variable.
BOOLEAN
 Data type
 True Or False
 Comparing values
INPUT OPERATOR
 input()
KEYWORDS
and exec not
assert finally or
break for pass
class from print
continue global raise
def if return
del import try
elif in while
else is with
except lambda yield
INDENTATION
 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.
COMMENTS IN PYTHON
OPERATORS
ARITHMETIC OPERATOR
ARITHMETIC OPERATORS
RELATIONAL OPERATOR
EXAMPLES OF RELATIONAL OPERATOR
ASSIGNMENT OPERATOR
Python programming
LOGICAL OPERATOR
Python programming
MEMBERSHIP OPERATOR
 test whether a value is a member of a sequence.
 The sequence may be a list, a string, or a tuple.
 Two membership python operators
 in and not in.
EXAMPLES FOR MEMBERSHIP OPERATOR
IDENTITY OPERATORS
 Identity operators are used to compare the objects.
 not if they are equal, but if they are actually the same object, with the same
memory location:
 There are different identity operators such as
 is operator  Returns true if both variables are the same object
 is not operator - Returns true if both variables are not the same object.
IDENTITY OPERATORS
IDENTITY OPERATORS
DECISION CONTROL STATEMENTS
 It decides the sequence in which the instructions in a program are to be
executed.
 Instructions can be one or more.
 3 types of control statements :
 Sequential
 Selection
 Iteration
SEQUENTIAL STATEMENTS
 Sequential statements :are a set of statements whose execution process
happens in a sequence. The problem with sequential statements is that if the
logic has broken in any one of the lines, then the complete source code
execution will break.
SELECTION/DECISION CONTROL STATEMENTS
 Selection statements are also known as Decision control
statements or branching statements.
 The selection statement allows a program to test several conditions and
execute instructions based on which condition is true.
 Some Decision Control Statements are:
 Simple if
 if-else
 nested if
 if-elif-else
Simple if
if-else
Nested iF
if-elif-else
ITERATIVE/ LOOPING STATEMENTS
 used to repeat a group(block) of programming instructions.
 two loops/iterative statements:
 for loop
 while loop
for loop
 for loop: A for loop is used to iterate over a sequence that is either a list,
tuple, dictionary, or a set.
 We can execute a set of statements once for each item in a list, tuple, or
dictionary.
for loop
Range function()
 The range() function returns a sequence of numbers, starting from 0 by
default, and increments by 1 (by default), and stops before a specified
number.
while loop
 With the while loop we can execute a set of statements as long as
a condition is true.
THE BREAK STATEMENT
 With the break statement we can stop the loop even if the while condition is
true:
THE CONTINUE STATEMENT
 With the continue statement we can stop the current iteration, and continue
with the next:
DATA STRUCTURES IN PYTHON
 Organizing,
 managing and
 storing data
 Data Structures allows you to organize your data in such a way
that enables you to store collections of data, relate them and
perform operations on them accordingly.
Easier access and
efficient modifications
DATA STRUCTURES IN PYTHON
 Types of Data Structures in Python
TYPES OF DATA STRUCTURES IN PYTHON
 Python has implicit support for Data Structures which enable you to store and
access data.
 Built-in Data Structures
 These Data Structures are built-in with Python which makes programming easier and helps
programmers use them to obtain solutions faster.
 Lists
 Lists are used to store data of different data types in a sequential manner.
 There are addresses assigned to every element of the list, which is called as Index.
 The index value starts from 0 and goes on until the last element called the positive
index.
 Negative indexing which starts from -1 enabling you to access elements from the
last to first.
LISTS
 Creating a list:
LISTS
 Adding Elements:
 append()
 extend()
 insert() functions
 The append() function- adds all the elements passed to it as a single element.
 The extend() function- adds the elements one-by-one into the list.
 The insert() function- adds the element passed to the index value and increase
the size of the list too.
LISTS
 Adding Elements:
 The append() function- adds all the elements passed to it as a single element.
LISTS
 Adding Elements:
 The extend() function- adds the elements one-by-one into the list.
LISTS
 Adding Elements:
 The insert() function- adds the element passed to the index value and increase
the size of the list too.
LISTS
 Deleting Elements:
 To delete elements, use the del keyword.
 If you want the element back, you use the pop() function which takes the
index value.
 To remove an element by its value, you use the remove() function.
LISTS
 Accessing Elements:
pass the index values and hence can obtain the values as needed.
LISTS
 Accessing Elements:
LISTS
 Other Functions:
 The len(): function returns the length of the list.
 The index(): function finds the index value of value passed where it has been
encountered the first time.
 The count() :function finds the count of the value passed to it.
 The sorted() and sort(): functions do the same thing, that is to sort the values of
the list. The sorted() has a return type whereas the sort() modifies the original
list.
LISTS
 Other Functions:
LISTS
 Other Functions:
 concatenate- method 1
LISTS
 Other Functions:
 concatenate- method 2
LISTS
 Other Functions:
 concatenate- method 3 ( list comprehension ) list=[expression for variables
in sequence]
LISTS
 Other Functions:
 concatenate- method 4 ( using *)
LISTS
 Other Functions:
 list.remove(x): Remove the first item from the list whose value is equal to x. It
raises a ValueError if there is no such item.
 list.reverse():Reverse the elements of the list in place.
 list.copy():Return a shallow copy of the list. Equivalent to a[:].
LISTS
 Other Functions:
list.pop([i]):Remove the item at the given position in the list, and return it. If no
index is specified, a.pop() removes and returns the last item in the list.
list.clear(): Remove all items from the list. Equivalent to del a[:].
USING LISTS AS STACKS
 The list as a stack, where the last element added is the first element retrieved
(last-in, first-out). To add an item to the top of the stack, use append(). To
retrieve an item from the top of the stack, use pop() without an explicit index.
USING LISTS AS QUEUES
 List as a queue, where the first element added is the first element retrieved
(first-in, first-out); however, lists are not efficient for this purpose. While
appends and pops from the end of list are fast, doing inserts or pops from the
beginning of a list is slow (because all of the other elements have to be shifted
by one).

More Related Content

What's hot (16)

Csharp_List
Csharp_ListCsharp_List
Csharp_List
Micheal Ogundero
Basic Sorting algorithms csharp
Basic Sorting algorithms csharpBasic Sorting algorithms csharp
Basic Sorting algorithms csharp
Micheal Ogundero
Learning Web Development with Django - Templates
Learning Web Development with Django - TemplatesLearning Web Development with Django - Templates
Learning Web Development with Django - Templates
Hsuan-Wen Liu
Java Tutorial Lab 1
Java Tutorial Lab 1Java Tutorial Lab 1
Java Tutorial Lab 1
Berk Soysal
Lisp
LispLisp
Lisp
Fraboni Ec
Java 103 intro to java data structures
Java 103   intro to java data structuresJava 103   intro to java data structures
Java 103 intro to java data structures
agorolabs
Python basics
Python basicsPython basics
Python basics
Shivaum Kumar
8 python data structure-1
8 python data structure-18 python data structure-1
8 python data structure-1
Prof. Dr. K. Adisesha
Collections Training
Collections TrainingCollections Training
Collections Training
Ramindu Deshapriya
Aaa ped-3. Pythond: advanced concepts
Aaa ped-3. Pythond: advanced conceptsAaa ped-3. Pythond: advanced concepts
Aaa ped-3. Pythond: advanced concepts
AminaRepo
Stacks
StacksStacks
Stacks
FarithaRiyaz
Data and donuts: Data Visualization using R
Data and donuts: Data Visualization using RData and donuts: Data Visualization using R
Data and donuts: Data Visualization using R
C. Tobin Magle
Md08 collection api
Md08 collection apiMd08 collection api
Md08 collection api
Rakesh Madugula
Generics In and Out
Generics In and OutGenerics In and Out
Generics In and Out
Jaliya Udagedara
Intro++ to C#
Intro++ to C#Intro++ to C#
Intro++ to C#
Pixelles / Rebecca Cohen-Palacios
Java util
Java utilJava util
Java util
Srikrishna k
Basic Sorting algorithms csharp
Basic Sorting algorithms csharpBasic Sorting algorithms csharp
Basic Sorting algorithms csharp
Micheal Ogundero
Learning Web Development with Django - Templates
Learning Web Development with Django - TemplatesLearning Web Development with Django - Templates
Learning Web Development with Django - Templates
Hsuan-Wen Liu
Java Tutorial Lab 1
Java Tutorial Lab 1Java Tutorial Lab 1
Java Tutorial Lab 1
Berk Soysal
Java 103 intro to java data structures
Java 103   intro to java data structuresJava 103   intro to java data structures
Java 103 intro to java data structures
agorolabs
Aaa ped-3. Pythond: advanced concepts
Aaa ped-3. Pythond: advanced conceptsAaa ped-3. Pythond: advanced concepts
Aaa ped-3. Pythond: advanced concepts
AminaRepo
Data and donuts: Data Visualization using R
Data and donuts: Data Visualization using RData and donuts: Data Visualization using R
Data and donuts: Data Visualization using R
C. Tobin Magle

Similar to Python programming (20)

MODULE-2.pptx
MODULE-2.pptxMODULE-2.pptx
MODULE-2.pptx
ASRPANDEY
Python Tutorial Part 1
Python Tutorial Part 1Python Tutorial Part 1
Python Tutorial Part 1
Haitham El-Ghareeb
stack.pptx
stack.pptxstack.pptx
stack.pptx
mayankKatiyar17
lecture 02.2.ppt
lecture 02.2.pptlecture 02.2.ppt
lecture 02.2.ppt
NathanielAdika
1664611760basics-of-python-for begainer1 (3).pptx
1664611760basics-of-python-for begainer1 (3).pptx1664611760basics-of-python-for begainer1 (3).pptx
1664611760basics-of-python-for begainer1 (3).pptx
krsonupandey92
Programming with Python - Week 3
Programming with Python - Week 3Programming with Python - Week 3
Programming with Python - Week 3
Ahmet Bulut
Python Demo.pptx
Python Demo.pptxPython Demo.pptx
Python Demo.pptx
ParveenShaik21
Python Demo.pptx
Python Demo.pptxPython Demo.pptx
Python Demo.pptx
ParveenShaik21
02._Object-Oriented_Programming_Concepts.ppt
02._Object-Oriented_Programming_Concepts.ppt02._Object-Oriented_Programming_Concepts.ppt
02._Object-Oriented_Programming_Concepts.ppt
Yonas D. Ebren
Data Structure Stack operation in python
Data Structure Stack operation in pythonData Structure Stack operation in python
Data Structure Stack operation in python
deepalishinkar1
fundamental of python --- vivek singh shekawat
fundamental  of python --- vivek singh shekawatfundamental  of python --- vivek singh shekawat
fundamental of python --- vivek singh shekawat
shekhawatasshp
python_computer engineering_semester_computer_language.pptx
python_computer engineering_semester_computer_language.pptxpython_computer engineering_semester_computer_language.pptx
python_computer engineering_semester_computer_language.pptx
MadhusmitaSahu40
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
Julie Iskander
data structures queue stack insert and delete time complexity
data structures queue stack insert and delete time complexitydata structures queue stack insert and delete time complexity
data structures queue stack insert and delete time complexity
libannpost
Python For Data Science.pptx
Python For Data Science.pptxPython For Data Science.pptx
Python For Data Science.pptx
rohithprabhas1
Queues
Queues Queues
Queues
nidhisatija1
Module 3,4.pptx
Module 3,4.pptxModule 3,4.pptx
Module 3,4.pptx
SandeepR95
Lecture 1 Abstract Data Types of Complexity Analysis of Big Oh Notation.pptx
Lecture 1 Abstract Data Types of Complexity Analysis of Big Oh Notation.pptxLecture 1 Abstract Data Types of Complexity Analysis of Big Oh Notation.pptx
Lecture 1 Abstract Data Types of Complexity Analysis of Big Oh Notation.pptx
yhrcxd8wpm
Lecture 1 Abstract Data Types of Complexity Analysis of Big Oh Notation.pptx
Lecture 1 Abstract Data Types of Complexity Analysis of Big Oh Notation.pptxLecture 1 Abstract Data Types of Complexity Analysis of Big Oh Notation.pptx
Lecture 1 Abstract Data Types of Complexity Analysis of Big Oh Notation.pptx
yhrcxd8wpm
Basic concept of Python.pptx includes design tool, identifier, variables.
Basic concept of Python.pptx includes design tool, identifier, variables.Basic concept of Python.pptx includes design tool, identifier, variables.
Basic concept of Python.pptx includes design tool, identifier, variables.
supriyasarkar38
MODULE-2.pptx
MODULE-2.pptxMODULE-2.pptx
MODULE-2.pptx
ASRPANDEY
1664611760basics-of-python-for begainer1 (3).pptx
1664611760basics-of-python-for begainer1 (3).pptx1664611760basics-of-python-for begainer1 (3).pptx
1664611760basics-of-python-for begainer1 (3).pptx
krsonupandey92
Programming with Python - Week 3
Programming with Python - Week 3Programming with Python - Week 3
Programming with Python - Week 3
Ahmet Bulut
02._Object-Oriented_Programming_Concepts.ppt
02._Object-Oriented_Programming_Concepts.ppt02._Object-Oriented_Programming_Concepts.ppt
02._Object-Oriented_Programming_Concepts.ppt
Yonas D. Ebren
Data Structure Stack operation in python
Data Structure Stack operation in pythonData Structure Stack operation in python
Data Structure Stack operation in python
deepalishinkar1
fundamental of python --- vivek singh shekawat
fundamental  of python --- vivek singh shekawatfundamental  of python --- vivek singh shekawat
fundamental of python --- vivek singh shekawat
shekhawatasshp
python_computer engineering_semester_computer_language.pptx
python_computer engineering_semester_computer_language.pptxpython_computer engineering_semester_computer_language.pptx
python_computer engineering_semester_computer_language.pptx
MadhusmitaSahu40
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
Julie Iskander
data structures queue stack insert and delete time complexity
data structures queue stack insert and delete time complexitydata structures queue stack insert and delete time complexity
data structures queue stack insert and delete time complexity
libannpost
Python For Data Science.pptx
Python For Data Science.pptxPython For Data Science.pptx
Python For Data Science.pptx
rohithprabhas1
Module 3,4.pptx
Module 3,4.pptxModule 3,4.pptx
Module 3,4.pptx
SandeepR95
Lecture 1 Abstract Data Types of Complexity Analysis of Big Oh Notation.pptx
Lecture 1 Abstract Data Types of Complexity Analysis of Big Oh Notation.pptxLecture 1 Abstract Data Types of Complexity Analysis of Big Oh Notation.pptx
Lecture 1 Abstract Data Types of Complexity Analysis of Big Oh Notation.pptx
yhrcxd8wpm
Lecture 1 Abstract Data Types of Complexity Analysis of Big Oh Notation.pptx
Lecture 1 Abstract Data Types of Complexity Analysis of Big Oh Notation.pptxLecture 1 Abstract Data Types of Complexity Analysis of Big Oh Notation.pptx
Lecture 1 Abstract Data Types of Complexity Analysis of Big Oh Notation.pptx
yhrcxd8wpm
Basic concept of Python.pptx includes design tool, identifier, variables.
Basic concept of Python.pptx includes design tool, identifier, variables.Basic concept of Python.pptx includes design tool, identifier, variables.
Basic concept of Python.pptx includes design tool, identifier, variables.
supriyasarkar38

More from sirikeshava (8)

Functions in c language1
Functions in c language1Functions in c language1
Functions in c language1
sirikeshava
Siri linux installation
Siri linux installationSiri linux installation
Siri linux installation
sirikeshava
Siri hardware troubleshooting
Siri hardware troubleshootingSiri hardware troubleshooting
Siri hardware troubleshooting
sirikeshava
Siri softwaretroubleshooting.doc
Siri softwaretroubleshooting.docSiri softwaretroubleshooting.doc
Siri softwaretroubleshooting.doc
sirikeshava
Siri bootcamp
Siri bootcampSiri bootcamp
Siri bootcamp
sirikeshava
Week8 siri
Week8 siriWeek8 siri
Week8 siri
sirikeshava
IT Workshop PC-HARDWARE Week3
IT Workshop PC-HARDWARE Week3IT Workshop PC-HARDWARE Week3
IT Workshop PC-HARDWARE Week3
sirikeshava
QOS oriented vho scheme for wifi and wimax overlay networks
QOS oriented vho scheme for wifi and wimax overlay networksQOS oriented vho scheme for wifi and wimax overlay networks
QOS oriented vho scheme for wifi and wimax overlay networks
sirikeshava
Functions in c language1
Functions in c language1Functions in c language1
Functions in c language1
sirikeshava
Siri linux installation
Siri linux installationSiri linux installation
Siri linux installation
sirikeshava
Siri hardware troubleshooting
Siri hardware troubleshootingSiri hardware troubleshooting
Siri hardware troubleshooting
sirikeshava
Siri softwaretroubleshooting.doc
Siri softwaretroubleshooting.docSiri softwaretroubleshooting.doc
Siri softwaretroubleshooting.doc
sirikeshava
Siri bootcamp
Siri bootcampSiri bootcamp
Siri bootcamp
sirikeshava
IT Workshop PC-HARDWARE Week3
IT Workshop PC-HARDWARE Week3IT Workshop PC-HARDWARE Week3
IT Workshop PC-HARDWARE Week3
sirikeshava
QOS oriented vho scheme for wifi and wimax overlay networks
QOS oriented vho scheme for wifi and wimax overlay networksQOS oriented vho scheme for wifi and wimax overlay networks
QOS oriented vho scheme for wifi and wimax overlay networks
sirikeshava

Recently uploaded (20)

UHV Unit - 4 HARMONY IN THE NATURE AND EXISTENCE.pptx
UHV Unit - 4 HARMONY IN THE NATURE AND EXISTENCE.pptxUHV Unit - 4 HARMONY IN THE NATURE AND EXISTENCE.pptx
UHV Unit - 4 HARMONY IN THE NATURE AND EXISTENCE.pptx
arivazhaganrajangam
"Introduction to VLSI Design: Concepts and Applications"
"Introduction to VLSI Design: Concepts and Applications""Introduction to VLSI Design: Concepts and Applications"
"Introduction to VLSI Design: Concepts and Applications"
GtxDriver
Airport Components Part1 ppt.pptx-Site layout,RUNWAY,TAXIWAY,TAXILANE
Airport Components Part1 ppt.pptx-Site layout,RUNWAY,TAXIWAY,TAXILANEAirport Components Part1 ppt.pptx-Site layout,RUNWAY,TAXIWAY,TAXILANE
Airport Components Part1 ppt.pptx-Site layout,RUNWAY,TAXIWAY,TAXILANE
Priyanka Dange
CS50x: CS50's Introduction to Computer Science.pdf
CS50x: CS50's Introduction to Computer Science.pdfCS50x: CS50's Introduction to Computer Science.pdf
CS50x: CS50's Introduction to Computer Science.pdf
Naiyan Noor
Mix Design of M40 Concrete & Application of NDT.pptx
Mix Design of M40 Concrete & Application of NDT.pptxMix Design of M40 Concrete & Application of NDT.pptx
Mix Design of M40 Concrete & Application of NDT.pptx
narayan311979
Airport Components Part2 ppt.pptx-Apron,Hangers,Terminal building
Airport Components Part2 ppt.pptx-Apron,Hangers,Terminal buildingAirport Components Part2 ppt.pptx-Apron,Hangers,Terminal building
Airport Components Part2 ppt.pptx-Apron,Hangers,Terminal building
Priyanka Dange
windrose1.ppt for seminar of civil .pptx
windrose1.ppt for seminar of civil .pptxwindrose1.ppt for seminar of civil .pptx
windrose1.ppt for seminar of civil .pptx
nukeshpandey5678
Introduction to CLoud Computing Technologies
Introduction to CLoud Computing TechnologiesIntroduction to CLoud Computing Technologies
Introduction to CLoud Computing Technologies
cloudlab1
Intro of Airport Engg..pptx-Definition of airport engineering and airport pla...
Intro of Airport Engg..pptx-Definition of airport engineering and airport pla...Intro of Airport Engg..pptx-Definition of airport engineering and airport pla...
Intro of Airport Engg..pptx-Definition of airport engineering and airport pla...
Priyanka Dange
UHV UNIT-I INTRODUCTION TO VALUE EDUCATION.pptx
UHV UNIT-I INTRODUCTION TO VALUE EDUCATION.pptxUHV UNIT-I INTRODUCTION TO VALUE EDUCATION.pptx
UHV UNIT-I INTRODUCTION TO VALUE EDUCATION.pptx
arivazhaganrajangam
he Wright brothers, Orville and Wilbur, invented and flew the first successfu...
he Wright brothers, Orville and Wilbur, invented and flew the first successfu...he Wright brothers, Orville and Wilbur, invented and flew the first successfu...
he Wright brothers, Orville and Wilbur, invented and flew the first successfu...
HardeepZinta2
Transformer ppt for micro-teaching (2).pptx
Transformer ppt for micro-teaching (2).pptxTransformer ppt for micro-teaching (2).pptx
Transformer ppt for micro-teaching (2).pptx
GetahunShankoKefeni
MODULE 01 - CLOUD COMPUTING [BIS 613D] .pptx
MODULE 01 - CLOUD COMPUTING [BIS 613D] .pptxMODULE 01 - CLOUD COMPUTING [BIS 613D] .pptx
MODULE 01 - CLOUD COMPUTING [BIS 613D] .pptx
Alvas Institute of Engineering and technology, Moodabidri
BCS401 ADA Module 1 PPT 2024-25 IV SEM.pptx
BCS401 ADA Module 1 PPT 2024-25 IV SEM.pptxBCS401 ADA Module 1 PPT 2024-25 IV SEM.pptx
BCS401 ADA Module 1 PPT 2024-25 IV SEM.pptx
VENKATESHBHAT25
4. "Exploring the Role of Lubrication in Machinery Efficiency: Mechanisms, Ty...
4. "Exploring the Role of Lubrication in Machinery Efficiency: Mechanisms, Ty...4. "Exploring the Role of Lubrication in Machinery Efficiency: Mechanisms, Ty...
4. "Exploring the Role of Lubrication in Machinery Efficiency: Mechanisms, Ty...
adityaprakashme26
Final Round of technical quiz on Chandrayaan
Final Round of technical quiz on ChandrayaanFinal Round of technical quiz on Chandrayaan
Final Round of technical quiz on Chandrayaan
kamesh sonti
Chemical_Safety | Chemical Safety Management | Gaurav Singh Rajput
Chemical_Safety | Chemical Safety Management | Gaurav Singh RajputChemical_Safety | Chemical Safety Management | Gaurav Singh Rajput
Chemical_Safety | Chemical Safety Management | Gaurav Singh Rajput
Gaurav Singh Rajput
Intro PPT SY_HONORS.pptx- Teaching scheme
Intro PPT SY_HONORS.pptx- Teaching schemeIntro PPT SY_HONORS.pptx- Teaching scheme
Intro PPT SY_HONORS.pptx- Teaching scheme
Priyanka Dange
BCS401 ADA First IA Test Question Bank.pdf
BCS401 ADA First IA Test Question Bank.pdfBCS401 ADA First IA Test Question Bank.pdf
BCS401 ADA First IA Test Question Bank.pdf
VENKATESHBHAT25
Reinventando el CD_ Unificando Aplicaciones e Infraestructura con Crossplane-...
Reinventando el CD_ Unificando Aplicaciones e Infraestructura con Crossplane-...Reinventando el CD_ Unificando Aplicaciones e Infraestructura con Crossplane-...
Reinventando el CD_ Unificando Aplicaciones e Infraestructura con Crossplane-...
Alberto Lorenzo
UHV Unit - 4 HARMONY IN THE NATURE AND EXISTENCE.pptx
UHV Unit - 4 HARMONY IN THE NATURE AND EXISTENCE.pptxUHV Unit - 4 HARMONY IN THE NATURE AND EXISTENCE.pptx
UHV Unit - 4 HARMONY IN THE NATURE AND EXISTENCE.pptx
arivazhaganrajangam
"Introduction to VLSI Design: Concepts and Applications"
"Introduction to VLSI Design: Concepts and Applications""Introduction to VLSI Design: Concepts and Applications"
"Introduction to VLSI Design: Concepts and Applications"
GtxDriver
Airport Components Part1 ppt.pptx-Site layout,RUNWAY,TAXIWAY,TAXILANE
Airport Components Part1 ppt.pptx-Site layout,RUNWAY,TAXIWAY,TAXILANEAirport Components Part1 ppt.pptx-Site layout,RUNWAY,TAXIWAY,TAXILANE
Airport Components Part1 ppt.pptx-Site layout,RUNWAY,TAXIWAY,TAXILANE
Priyanka Dange
CS50x: CS50's Introduction to Computer Science.pdf
CS50x: CS50's Introduction to Computer Science.pdfCS50x: CS50's Introduction to Computer Science.pdf
CS50x: CS50's Introduction to Computer Science.pdf
Naiyan Noor
Mix Design of M40 Concrete & Application of NDT.pptx
Mix Design of M40 Concrete & Application of NDT.pptxMix Design of M40 Concrete & Application of NDT.pptx
Mix Design of M40 Concrete & Application of NDT.pptx
narayan311979
Airport Components Part2 ppt.pptx-Apron,Hangers,Terminal building
Airport Components Part2 ppt.pptx-Apron,Hangers,Terminal buildingAirport Components Part2 ppt.pptx-Apron,Hangers,Terminal building
Airport Components Part2 ppt.pptx-Apron,Hangers,Terminal building
Priyanka Dange
windrose1.ppt for seminar of civil .pptx
windrose1.ppt for seminar of civil .pptxwindrose1.ppt for seminar of civil .pptx
windrose1.ppt for seminar of civil .pptx
nukeshpandey5678
Introduction to CLoud Computing Technologies
Introduction to CLoud Computing TechnologiesIntroduction to CLoud Computing Technologies
Introduction to CLoud Computing Technologies
cloudlab1
Intro of Airport Engg..pptx-Definition of airport engineering and airport pla...
Intro of Airport Engg..pptx-Definition of airport engineering and airport pla...Intro of Airport Engg..pptx-Definition of airport engineering and airport pla...
Intro of Airport Engg..pptx-Definition of airport engineering and airport pla...
Priyanka Dange
UHV UNIT-I INTRODUCTION TO VALUE EDUCATION.pptx
UHV UNIT-I INTRODUCTION TO VALUE EDUCATION.pptxUHV UNIT-I INTRODUCTION TO VALUE EDUCATION.pptx
UHV UNIT-I INTRODUCTION TO VALUE EDUCATION.pptx
arivazhaganrajangam
he Wright brothers, Orville and Wilbur, invented and flew the first successfu...
he Wright brothers, Orville and Wilbur, invented and flew the first successfu...he Wright brothers, Orville and Wilbur, invented and flew the first successfu...
he Wright brothers, Orville and Wilbur, invented and flew the first successfu...
HardeepZinta2
Transformer ppt for micro-teaching (2).pptx
Transformer ppt for micro-teaching (2).pptxTransformer ppt for micro-teaching (2).pptx
Transformer ppt for micro-teaching (2).pptx
GetahunShankoKefeni
BCS401 ADA Module 1 PPT 2024-25 IV SEM.pptx
BCS401 ADA Module 1 PPT 2024-25 IV SEM.pptxBCS401 ADA Module 1 PPT 2024-25 IV SEM.pptx
BCS401 ADA Module 1 PPT 2024-25 IV SEM.pptx
VENKATESHBHAT25
4. "Exploring the Role of Lubrication in Machinery Efficiency: Mechanisms, Ty...
4. "Exploring the Role of Lubrication in Machinery Efficiency: Mechanisms, Ty...4. "Exploring the Role of Lubrication in Machinery Efficiency: Mechanisms, Ty...
4. "Exploring the Role of Lubrication in Machinery Efficiency: Mechanisms, Ty...
adityaprakashme26
Final Round of technical quiz on Chandrayaan
Final Round of technical quiz on ChandrayaanFinal Round of technical quiz on Chandrayaan
Final Round of technical quiz on Chandrayaan
kamesh sonti
Chemical_Safety | Chemical Safety Management | Gaurav Singh Rajput
Chemical_Safety | Chemical Safety Management | Gaurav Singh RajputChemical_Safety | Chemical Safety Management | Gaurav Singh Rajput
Chemical_Safety | Chemical Safety Management | Gaurav Singh Rajput
Gaurav Singh Rajput
Intro PPT SY_HONORS.pptx- Teaching scheme
Intro PPT SY_HONORS.pptx- Teaching schemeIntro PPT SY_HONORS.pptx- Teaching scheme
Intro PPT SY_HONORS.pptx- Teaching scheme
Priyanka Dange
BCS401 ADA First IA Test Question Bank.pdf
BCS401 ADA First IA Test Question Bank.pdfBCS401 ADA First IA Test Question Bank.pdf
BCS401 ADA First IA Test Question Bank.pdf
VENKATESHBHAT25
Reinventando el CD_ Unificando Aplicaciones e Infraestructura con Crossplane-...
Reinventando el CD_ Unificando Aplicaciones e Infraestructura con Crossplane-...Reinventando el CD_ Unificando Aplicaciones e Infraestructura con Crossplane-...
Reinventando el CD_ Unificando Aplicaciones e Infraestructura con Crossplane-...
Alberto Lorenzo

Python programming

  • 2. INTRODUCTION TO PYTHON Object-oriented programming language Guido van Rossum in 1989. National Research Institute for Mathematics and Computer Science Netherlands The comedy group Monty Python.
  • 3. FEATURES OF PYTHON Versatile High Level programming Extensible Easy maintenance Robust Multi threaded Garbage collection Secure
  • 4. APPLICATIONS OF PYTHON Build a website Develop a game Perform Computer Vision (Facilities like face-detection and color-detection) Implement Machine Learning (Give a computer the ability to learn) Enable Robotics with Python Perform Web Scraping (Harvest data from websites) Perform Data Analysis using Python Automate a web browser Perform Scripting in Python Perform Scientific Computing using Python Build Artificial Intelligence
  • 5. APPLICATIONS OF PYTHON brands like YouTube, Dropbox, and Netflix Search-engine Google
  • 6. VARIABLES AND IDENTIFIERS X=20 Names starts with letters, numbers, underscores.
  • 7. DATA TYPES Variables can hold values of different types called data types. Assigning or Initializing values of variables:
  • 8. MULTIPLE ASSIGNMENT Allows to assign a single value to More than one variable.
  • 9. BOOLEAN Data type True Or False Comparing values
  • 11. KEYWORDS and exec not assert finally or break for pass class from print continue global raise def if return del import try elif in while else is with except lambda yield
  • 12. INDENTATION 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.
  • 23. MEMBERSHIP OPERATOR test whether a value is a member of a sequence. The sequence may be a list, a string, or a tuple. Two membership python operators in and not in.
  • 25. IDENTITY OPERATORS Identity operators are used to compare the objects. not if they are equal, but if they are actually the same object, with the same memory location: There are different identity operators such as is operator Returns true if both variables are the same object is not operator - Returns true if both variables are not the same object.
  • 28. DECISION CONTROL STATEMENTS It decides the sequence in which the instructions in a program are to be executed. Instructions can be one or more. 3 types of control statements : Sequential Selection Iteration
  • 29. SEQUENTIAL STATEMENTS Sequential statements :are a set of statements whose execution process happens in a sequence. The problem with sequential statements is that if the logic has broken in any one of the lines, then the complete source code execution will break.
  • 30. SELECTION/DECISION CONTROL STATEMENTS Selection statements are also known as Decision control statements or branching statements. The selection statement allows a program to test several conditions and execute instructions based on which condition is true. Some Decision Control Statements are: Simple if if-else nested if if-elif-else
  • 35. ITERATIVE/ LOOPING STATEMENTS used to repeat a group(block) of programming instructions. two loops/iterative statements: for loop while loop
  • 36. for loop for loop: A for loop is used to iterate over a sequence that is either a list, tuple, dictionary, or a set. We can execute a set of statements once for each item in a list, tuple, or dictionary.
  • 38. Range function() The range() function returns a sequence of numbers, starting from 0 by default, and increments by 1 (by default), and stops before a specified number.
  • 39. while loop With the while loop we can execute a set of statements as long as a condition is true.
  • 40. THE BREAK STATEMENT With the break statement we can stop the loop even if the while condition is true:
  • 41. THE CONTINUE STATEMENT With the continue statement we can stop the current iteration, and continue with the next:
  • 42. DATA STRUCTURES IN PYTHON Organizing, managing and storing data Data Structures allows you to organize your data in such a way that enables you to store collections of data, relate them and perform operations on them accordingly. Easier access and efficient modifications
  • 43. DATA STRUCTURES IN PYTHON Types of Data Structures in Python
  • 44. TYPES OF DATA STRUCTURES IN PYTHON Python has implicit support for Data Structures which enable you to store and access data. Built-in Data Structures These Data Structures are built-in with Python which makes programming easier and helps programmers use them to obtain solutions faster. Lists Lists are used to store data of different data types in a sequential manner. There are addresses assigned to every element of the list, which is called as Index. The index value starts from 0 and goes on until the last element called the positive index. Negative indexing which starts from -1 enabling you to access elements from the last to first.
  • 46. LISTS Adding Elements: append() extend() insert() functions The append() function- adds all the elements passed to it as a single element. The extend() function- adds the elements one-by-one into the list. The insert() function- adds the element passed to the index value and increase the size of the list too.
  • 47. LISTS Adding Elements: The append() function- adds all the elements passed to it as a single element.
  • 48. LISTS Adding Elements: The extend() function- adds the elements one-by-one into the list.
  • 49. LISTS Adding Elements: The insert() function- adds the element passed to the index value and increase the size of the list too.
  • 50. LISTS Deleting Elements: To delete elements, use the del keyword. If you want the element back, you use the pop() function which takes the index value. To remove an element by its value, you use the remove() function.
  • 51. LISTS Accessing Elements: pass the index values and hence can obtain the values as needed.
  • 53. LISTS Other Functions: The len(): function returns the length of the list. The index(): function finds the index value of value passed where it has been encountered the first time. The count() :function finds the count of the value passed to it. The sorted() and sort(): functions do the same thing, that is to sort the values of the list. The sorted() has a return type whereas the sort() modifies the original list.
  • 55. LISTS Other Functions: concatenate- method 1
  • 56. LISTS Other Functions: concatenate- method 2
  • 57. LISTS Other Functions: concatenate- method 3 ( list comprehension ) list=[expression for variables in sequence]
  • 58. LISTS Other Functions: concatenate- method 4 ( using *)
  • 59. LISTS Other Functions: list.remove(x): Remove the first item from the list whose value is equal to x. It raises a ValueError if there is no such item. list.reverse():Reverse the elements of the list in place. list.copy():Return a shallow copy of the list. Equivalent to a[:].
  • 60. LISTS Other Functions: list.pop([i]):Remove the item at the given position in the list, and return it. If no index is specified, a.pop() removes and returns the last item in the list. list.clear(): Remove all items from the list. Equivalent to del a[:].
  • 61. USING LISTS AS STACKS The list as a stack, where the last element added is the first element retrieved (last-in, first-out). To add an item to the top of the stack, use append(). To retrieve an item from the top of the stack, use pop() without an explicit index.
  • 62. USING LISTS AS QUEUES List as a queue, where the first element added is the first element retrieved (first-in, first-out); however, lists are not efficient for this purpose. While appends and pops from the end of list are fast, doing inserts or pops from the beginning of a list is slow (because all of the other elements have to be shifted by one).