SlideShare ist ein Scribd-Unternehmen logo
1 von 15
PYTHON LIST
By A. A. Bhumkar
PYTHON LIST
1).Python lists are the data structure that is capable of
holding different type of data.
2).Python lists are mutable i.e., Python will not create a
new list if we modify an element in the list.
3).It is a container that holds other objects in a given order.
Different operation like insertion and deletion can be
performed on lists.
4).A list can be composed by storing a sequence of
different type of values separated by commas.
5).A python list is enclosed between square([]) brackets.
6).The elements are stored in the index basis with starting
index as 0.
CREATING LIST
 A list can be created by putting the value inside the
square bracket and separated by comma.
 Syntax:
<list_name>=[value1,value2,value3,...,valuen];
 For accessing list :
<list_name>[index]
ELEMENTS IN A LISTS:
Data=[1,2,3,4,5];
LIST OPERATIONS:
a) Adding Lists:
Lists can be added by using the concatenation operator(+)
to join two lists.
Eg:
list1=[10,20]
list2=[30,40]
list3=list1+list2
print list3 Output:
>>>
[10, 20, 30, 40]
>>>
b) Replicating lists:
Replicating means repeating . It can be performed by
using '*' operator by a specific number of time.
Eg:
list1=[10,20]
print list1*1
Output:
>>>
[10, 20]
>>>
c) List slicing:
A subpart of a list can be retrieved on the basis of index.
This subpart is known as list slice.
Eg:
list1=[1,2,4,5,7]
print list1[0:2]
print list1[4]
list1[1]=9
print list1
Output:
>>>
[1, 2]
7
[1, 9, 4, 5, 7]
>>>
OTHER OPERATIONS:
a) Updating elements in a List:
To update or change the value of particular index of a list,
assign the value to that particular index of the List.
Syntax:
<list_name>[index]=<value>
Eg.
>>> list=[1,2,3,4]
>>> list[2]="Hello Python"
>>> print(list)
[1, 2, 'Hello Python', 4]
>>>
b) Appending elements to a List:
append() method is used to append i.e., add an element at
the end of the existing elements.
Syntax:
<list_name>.append(item)
Eg.
>>> list=[1,2,3,4]
>>> list.append(40)
>>> print(list)
[1, 2, 3, 4, 40]
>>>
c) Deleting Elements from a List:
del statement can be used to delete an element from the
list. It can also be used to delete all items from
startIndex to endIndex.
Eg.
>>> list = [1,2,3,4]
>>> del list[2]
>>> print(list)
[1, 2, 4]
FUNCTIONS AND METHODS OF LISTS:
Function Description Example
min(list)
Returns the minimum
value from the list
given.
>>> list=[1,2,3,4,5]
>>> min(list)
1
max(list)
Returns the largest
value from the given
list.
>>> list=[1,2,3,4,5]
>>> max(list)
5
len(list)
Returns number of
elements in a list.
>>> list=[1,2,3,4,5]
>>> len(list)
5
Methods Description Example
index(object)
Returns the index value of the
object.
>>> l = ['a','b','c','d']
>>>l.index(‘a’)
>>>0
count(object)
It returns the number of times an
object is repeated in list.
>>> l = [1,2,3,1,4,5,1]
>>> l.count(1)
3
pop()/pop(index)
Returns the last object or the
specified indexed object. It
removes the popped object.
>>> l = [1,2,3,1,4,5,1]
>>> l.pop()
1
>>> print(list)
[1, 2, 3, 4, 5]
>>> l.pop(3)
1
>>> print(l)
[1, 2, 3, 4, 5]
Methods Description Example
insert(index,object)
Insert an object at the
given index.
>>>l=[1,2,3,4,5]
>>> l.insert(3,11)
>>> print(l)
[1, 2, 3, 11, 4, 5]
extend(sequence)
It adds the sequence to
existing list.
>>>l=[1, 2, 3, 11, 4, 5]
>>> seq = (12,13)
>>> l.extend(seq)
>>> print(l)
[1, 2, 3, 11, 4, 5, 12, 13]
remove(object)
It removes the object
from the given List.
>>>l=[1, 2, 3, 11, 4, 5, 12,
13]
>>> l.remove(12)
>>> print(l)
[1, 2, 3, 11, 4, 5, 13]
Methods Description
Example
reverse()
Reverse the position of all the
elements of a list.
>>>l=[1, 2, 3, 11, 4, 5, 13]
>>> l.reverse()
>>> print(l)
[13, 5, 4, 11, 3, 2, 1]
sort()
It is used to sort the elements
of the List.
>>> l = [2,4,1,5,3]
>>> l.sort()
>>> print(l)
[1, 2, 3, 4, 5]
THANK YOU !!!

Weitere ähnliche Inhalte

Was ist angesagt? (20)

Unit 4 python -list methods
Unit 4   python -list methodsUnit 4   python -list methods
Unit 4 python -list methods
 
Python tuple
Python   tuplePython   tuple
Python tuple
 
Functions in python
Functions in pythonFunctions in python
Functions in python
 
List in Python
List in PythonList in Python
List in Python
 
Sets in python
Sets in pythonSets in python
Sets in python
 
Python lists &amp; sets
Python lists &amp; setsPython lists &amp; sets
Python lists &amp; sets
 
Stacks IN DATA STRUCTURES
Stacks IN DATA STRUCTURESStacks IN DATA STRUCTURES
Stacks IN DATA STRUCTURES
 
Arrays
ArraysArrays
Arrays
 
Stacks in c++
Stacks in c++Stacks in c++
Stacks in c++
 
Lists
ListsLists
Lists
 
Python programming : List and tuples
Python programming : List and tuplesPython programming : List and tuples
Python programming : List and tuples
 
Python-List.pptx
Python-List.pptxPython-List.pptx
Python-List.pptx
 
Arrays in python
Arrays in pythonArrays in python
Arrays in python
 
Function overloading ppt
Function overloading pptFunction overloading ppt
Function overloading ppt
 
Array Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional arrayArray Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional array
 
Python Variable Types, List, Tuple, Dictionary
Python Variable Types, List, Tuple, DictionaryPython Variable Types, List, Tuple, Dictionary
Python Variable Types, List, Tuple, Dictionary
 
Python OOPs
Python OOPsPython OOPs
Python OOPs
 
Data Structures in Python
Data Structures in PythonData Structures in Python
Data Structures in Python
 
Functions in python slide share
Functions in python slide shareFunctions in python slide share
Functions in python slide share
 
stack & queue
stack & queuestack & queue
stack & queue
 

Ähnlich wie Python list

Python List.ppt
Python List.pptPython List.ppt
Python List.pptT PRIYA
 
Lecture2.pptx
Lecture2.pptxLecture2.pptx
Lecture2.pptxSakith1
 
lists_list_of_liststuples_of_python.pptx
lists_list_of_liststuples_of_python.pptxlists_list_of_liststuples_of_python.pptx
lists_list_of_liststuples_of_python.pptxShanthiJeyabal
 
The Ring programming language version 1.5.3 book - Part 22 of 184
The Ring programming language version 1.5.3 book - Part 22 of 184The Ring programming language version 1.5.3 book - Part 22 of 184
The Ring programming language version 1.5.3 book - Part 22 of 184Mahmoud Samir Fayed
 
Data type list_methods_in_python
Data type list_methods_in_pythonData type list_methods_in_python
Data type list_methods_in_pythondeepalishinkar1
 
The Ring programming language version 1.9 book - Part 29 of 210
The Ring programming language version 1.9 book - Part 29 of 210The Ring programming language version 1.9 book - Part 29 of 210
The Ring programming language version 1.9 book - Part 29 of 210Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 27 of 202
The Ring programming language version 1.8 book - Part 27 of 202The Ring programming language version 1.8 book - Part 27 of 202
The Ring programming language version 1.8 book - Part 27 of 202Mahmoud Samir Fayed
 
Python Unit 5 Questions n Notes.pdf
Python Unit 5 Questions n Notes.pdfPython Unit 5 Questions n Notes.pdf
Python Unit 5 Questions n Notes.pdfMCCMOTOR
 
Python list concept
Python list conceptPython list concept
Python list conceptDrJSaiGeetha
 
The Ring programming language version 1.10 book - Part 30 of 212
The Ring programming language version 1.10 book - Part 30 of 212The Ring programming language version 1.10 book - Part 30 of 212
The Ring programming language version 1.10 book - Part 30 of 212Mahmoud Samir Fayed
 
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdf
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdfGE3151 PSPP UNIT IV QUESTION BANK.docx.pdf
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdfAsst.prof M.Gokilavani
 
python_avw - Unit-03.pdf
python_avw - Unit-03.pdfpython_avw - Unit-03.pdf
python_avw - Unit-03.pdfAshaWankar1
 
lists8.pptx of chapter 12 IP Basic Python
lists8.pptx of chapter 12 IP Basic Pythonlists8.pptx of chapter 12 IP Basic Python
lists8.pptx of chapter 12 IP Basic Pythonkvpv2023
 

Ähnlich wie Python list (20)

Chapter 15 Lists
Chapter 15 ListsChapter 15 Lists
Chapter 15 Lists
 
Python List.ppt
Python List.pptPython List.ppt
Python List.ppt
 
Lecture2.pptx
Lecture2.pptxLecture2.pptx
Lecture2.pptx
 
lists_list_of_liststuples_of_python.pptx
lists_list_of_liststuples_of_python.pptxlists_list_of_liststuples_of_python.pptx
lists_list_of_liststuples_of_python.pptx
 
Module III.pdf
Module III.pdfModule III.pdf
Module III.pdf
 
Python lists
Python listsPython lists
Python lists
 
The Ring programming language version 1.5.3 book - Part 22 of 184
The Ring programming language version 1.5.3 book - Part 22 of 184The Ring programming language version 1.5.3 book - Part 22 of 184
The Ring programming language version 1.5.3 book - Part 22 of 184
 
Python for Beginners(v3)
Python for Beginners(v3)Python for Beginners(v3)
Python for Beginners(v3)
 
Data type list_methods_in_python
Data type list_methods_in_pythonData type list_methods_in_python
Data type list_methods_in_python
 
The Ring programming language version 1.9 book - Part 29 of 210
The Ring programming language version 1.9 book - Part 29 of 210The Ring programming language version 1.9 book - Part 29 of 210
The Ring programming language version 1.9 book - Part 29 of 210
 
8 python data structure-1
8 python data structure-18 python data structure-1
8 python data structure-1
 
The Ring programming language version 1.8 book - Part 27 of 202
The Ring programming language version 1.8 book - Part 27 of 202The Ring programming language version 1.8 book - Part 27 of 202
The Ring programming language version 1.8 book - Part 27 of 202
 
Python Unit 5 Questions n Notes.pdf
Python Unit 5 Questions n Notes.pdfPython Unit 5 Questions n Notes.pdf
Python Unit 5 Questions n Notes.pdf
 
Python list concept
Python list conceptPython list concept
Python list concept
 
The Ring programming language version 1.10 book - Part 30 of 212
The Ring programming language version 1.10 book - Part 30 of 212The Ring programming language version 1.10 book - Part 30 of 212
The Ring programming language version 1.10 book - Part 30 of 212
 
updated_list.pptx
updated_list.pptxupdated_list.pptx
updated_list.pptx
 
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdf
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdfGE3151 PSPP UNIT IV QUESTION BANK.docx.pdf
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdf
 
python_avw - Unit-03.pdf
python_avw - Unit-03.pdfpython_avw - Unit-03.pdf
python_avw - Unit-03.pdf
 
lists8.pptx of chapter 12 IP Basic Python
lists8.pptx of chapter 12 IP Basic Pythonlists8.pptx of chapter 12 IP Basic Python
lists8.pptx of chapter 12 IP Basic Python
 
Module-2.pptx
Module-2.pptxModule-2.pptx
Module-2.pptx
 

Kürzlich hochgeladen

Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
(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
 
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
 
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
 
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
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
(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
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
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
 
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
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
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
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 

Kürzlich hochgeladen (20)

Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
(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...
 
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
 
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...
 
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
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
(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...
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
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 )
 
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
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
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
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 

Python list

  • 1. PYTHON LIST By A. A. Bhumkar
  • 2. PYTHON LIST 1).Python lists are the data structure that is capable of holding different type of data. 2).Python lists are mutable i.e., Python will not create a new list if we modify an element in the list. 3).It is a container that holds other objects in a given order. Different operation like insertion and deletion can be performed on lists. 4).A list can be composed by storing a sequence of different type of values separated by commas. 5).A python list is enclosed between square([]) brackets. 6).The elements are stored in the index basis with starting index as 0.
  • 3. CREATING LIST  A list can be created by putting the value inside the square bracket and separated by comma.  Syntax: <list_name>=[value1,value2,value3,...,valuen];  For accessing list : <list_name>[index]
  • 4. ELEMENTS IN A LISTS: Data=[1,2,3,4,5];
  • 5. LIST OPERATIONS: a) Adding Lists: Lists can be added by using the concatenation operator(+) to join two lists. Eg: list1=[10,20] list2=[30,40] list3=list1+list2 print list3 Output: >>> [10, 20, 30, 40] >>>
  • 6. b) Replicating lists: Replicating means repeating . It can be performed by using '*' operator by a specific number of time. Eg: list1=[10,20] print list1*1 Output: >>> [10, 20] >>>
  • 7. c) List slicing: A subpart of a list can be retrieved on the basis of index. This subpart is known as list slice. Eg: list1=[1,2,4,5,7] print list1[0:2] print list1[4] list1[1]=9 print list1 Output: >>> [1, 2] 7 [1, 9, 4, 5, 7] >>>
  • 8. OTHER OPERATIONS: a) Updating elements in a List: To update or change the value of particular index of a list, assign the value to that particular index of the List. Syntax: <list_name>[index]=<value> Eg. >>> list=[1,2,3,4] >>> list[2]="Hello Python" >>> print(list) [1, 2, 'Hello Python', 4] >>>
  • 9. b) Appending elements to a List: append() method is used to append i.e., add an element at the end of the existing elements. Syntax: <list_name>.append(item) Eg. >>> list=[1,2,3,4] >>> list.append(40) >>> print(list) [1, 2, 3, 4, 40] >>>
  • 10. c) Deleting Elements from a List: del statement can be used to delete an element from the list. It can also be used to delete all items from startIndex to endIndex. Eg. >>> list = [1,2,3,4] >>> del list[2] >>> print(list) [1, 2, 4]
  • 11. FUNCTIONS AND METHODS OF LISTS: Function Description Example min(list) Returns the minimum value from the list given. >>> list=[1,2,3,4,5] >>> min(list) 1 max(list) Returns the largest value from the given list. >>> list=[1,2,3,4,5] >>> max(list) 5 len(list) Returns number of elements in a list. >>> list=[1,2,3,4,5] >>> len(list) 5
  • 12. Methods Description Example index(object) Returns the index value of the object. >>> l = ['a','b','c','d'] >>>l.index(‘a’) >>>0 count(object) It returns the number of times an object is repeated in list. >>> l = [1,2,3,1,4,5,1] >>> l.count(1) 3 pop()/pop(index) Returns the last object or the specified indexed object. It removes the popped object. >>> l = [1,2,3,1,4,5,1] >>> l.pop() 1 >>> print(list) [1, 2, 3, 4, 5] >>> l.pop(3) 1 >>> print(l) [1, 2, 3, 4, 5]
  • 13. Methods Description Example insert(index,object) Insert an object at the given index. >>>l=[1,2,3,4,5] >>> l.insert(3,11) >>> print(l) [1, 2, 3, 11, 4, 5] extend(sequence) It adds the sequence to existing list. >>>l=[1, 2, 3, 11, 4, 5] >>> seq = (12,13) >>> l.extend(seq) >>> print(l) [1, 2, 3, 11, 4, 5, 12, 13] remove(object) It removes the object from the given List. >>>l=[1, 2, 3, 11, 4, 5, 12, 13] >>> l.remove(12) >>> print(l) [1, 2, 3, 11, 4, 5, 13]
  • 14. Methods Description Example reverse() Reverse the position of all the elements of a list. >>>l=[1, 2, 3, 11, 4, 5, 13] >>> l.reverse() >>> print(l) [13, 5, 4, 11, 3, 2, 1] sort() It is used to sort the elements of the List. >>> l = [2,4,1,5,3] >>> l.sort() >>> print(l) [1, 2, 3, 4, 5]