SlideShare a Scribd company logo
1 of 13
BVRIT HYDERABAD College of Engineering for Women
Python Programming
By
M Dyva Sugnana Rao
Asst. Professor
Department of Computer Science and Engineering
BVRIT HYDERABAD College of Engineering for Women
Name of the Course Python Programming
Course Code CS601PC
Year & Semester B.Tech VI Year I Sem
Section CSE - A
Name of the Faculty M Dyva Sugnana Rao
Lecture Hour | Date 02 | 28 October 2020
Name of the Topic List’s
Course Outcome(s) Explore about List’s
The List Data Type
A list is a value that contains multiple values in an ordered sequence.
Square bracket, [].
Values inside the list are also called Items.
Ex:
List1 = [1 , 2 , 3 , 4]
Lst2 = [12.5 , 6.7 , 8.9]
Lst = [‘asd’ , ’fgh’ , ’ghkgjj’]
List = [12 , ‘cat’ , 12.5,7,89999,’fghh’]
List with Indexes
Ex: List = [‘cat’ , ‘rat’ , ‘bat’, ‘mat’]
List[0]
List[1]
List[3]
List[5]
IndexError: list index out of range
List[1.0]
TypeError: list indices must be integers, not float
Lists can also contain other list values.
List = [ ['cat', 'bat'], [10, 20, 30, 40, 50] ]
List[0]
List[1]
List[0][1]
List[1][2]
Negative Indexes
The integer value -1 refers to the last index in a list.
List = ['cat', 'bat', 'rat', 'elephant']
List[-1]
List[-2]
Getting Sublists with Slices
Index can get a single value from a list, a slice can get several values
• List[2] is a list with an index (one integer).
• List[1:4] is a list with a slice (two integers).
Getting a List’s Length with len()
List = ['cat', 'dog', 'moose']
Len(list)
Changing Values in a List with Indexes
List = ['cat', 'bat', 'rat', 'elephant']
List [1] = ‘dog’
List[2]= List[1]
List Concatenation and List Replication
Removing Values from Lists with del Statements
List = ['cat', 'bat', 'rat', 'elephant']
Del List[2]
Del List[2]
Using for Loops with Lists
for i in [0, 1, 2, 3]:
print(i)
sort() Method
List = [2, 5, 3.14, 1, -7]
List.sort()
List.sort(reverse.true)
Observations:
List= List.sort()
List= [1, 3, 2, 4, 'Alice', 'Bob']
List = ['Alice', 'ants', 'Bob', 'badgers', 'Carol', 'cats']
BVRIT HYDERABAD College of Engineering for Women
Thankyou

More Related Content

What's hot

What's hot (20)

Arrays in python
Arrays in pythonArrays in python
Arrays in python
 
Arrays In Python | Python Array Operations | Edureka
Arrays In Python | Python Array Operations | EdurekaArrays In Python | Python Array Operations | Edureka
Arrays In Python | Python Array Operations | Edureka
 
Java -lec-6
Java -lec-6Java -lec-6
Java -lec-6
 
One Dimensional Array
One Dimensional Array One Dimensional Array
One Dimensional Array
 
Data structures
Data structuresData structures
Data structures
 
Array operations
Array operationsArray operations
Array operations
 
Unit 4 tree
Unit 4   treeUnit 4   tree
Unit 4 tree
 
Data structure power point presentation
Data structure power point presentation Data structure power point presentation
Data structure power point presentation
 
8 python data structure-1
8 python data structure-18 python data structure-1
8 python data structure-1
 
Elementary data structure
Elementary data structureElementary data structure
Elementary data structure
 
Data structure ppt
Data structure pptData structure ppt
Data structure ppt
 
Bca ii dfs u-1 introduction to data structure
Bca ii dfs u-1 introduction to data structureBca ii dfs u-1 introduction to data structure
Bca ii dfs u-1 introduction to data structure
 
Data structure and its types
Data structure and its typesData structure and its types
Data structure and its types
 
Python :variable types
Python :variable typesPython :variable types
Python :variable types
 
Java
JavaJava
Java
 
Data structure lecture 2
Data structure lecture 2Data structure lecture 2
Data structure lecture 2
 
ARRAY
ARRAYARRAY
ARRAY
 
Lecture 2a arrays
Lecture 2a arraysLecture 2a arrays
Lecture 2a arrays
 
Data structures
Data structuresData structures
Data structures
 
Array in Java
Array in JavaArray in Java
Array in Java
 

Similar to Python list 28_10_2020

Similar to Python list 28_10_2020 (20)

STRING LIST TUPLE DICTIONARY FILE.pdf
STRING LIST TUPLE DICTIONARY FILE.pdfSTRING LIST TUPLE DICTIONARY FILE.pdf
STRING LIST TUPLE DICTIONARY FILE.pdf
 
Python lists & sets
Python lists & setsPython lists & sets
Python lists & sets
 
Python lists
Python listsPython lists
Python lists
 
Unit - 4.ppt
Unit - 4.pptUnit - 4.ppt
Unit - 4.ppt
 
List_tuple_dictionary.pptx
List_tuple_dictionary.pptxList_tuple_dictionary.pptx
List_tuple_dictionary.pptx
 
Python list
Python listPython list
Python list
 
Python-List.pptx
Python-List.pptxPython-List.pptx
Python-List.pptx
 
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
 
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
 
Python data handling notes
Python data handling notesPython data handling notes
Python data handling notes
 
‏‏chap6 list tuples.pptx
‏‏chap6 list tuples.pptx‏‏chap6 list tuples.pptx
‏‏chap6 list tuples.pptx
 
Chapter 15 Lists
Chapter 15 ListsChapter 15 Lists
Chapter 15 Lists
 
Brixon Library Technology Initiative
Brixon Library Technology InitiativeBrixon Library Technology Initiative
Brixon Library Technology Initiative
 
python_avw - Unit-03.pdf
python_avw - Unit-03.pdfpython_avw - Unit-03.pdf
python_avw - Unit-03.pdf
 
Unit 4 python -list methods
Unit 4   python -list methodsUnit 4   python -list methods
Unit 4 python -list methods
 
Python list
Python listPython list
Python list
 
Python-Ukllllllllllllllllllllllllllllnit 2.pdklllllllf
Python-Ukllllllllllllllllllllllllllllnit 2.pdklllllllfPython-Ukllllllllllllllllllllllllllllnit 2.pdklllllllf
Python-Ukllllllllllllllllllllllllllllnit 2.pdklllllllf
 
Python for Beginners(v3)
Python for Beginners(v3)Python for Beginners(v3)
Python for Beginners(v3)
 
LIST IN PYTHON PART-2
LIST IN PYTHON PART-2LIST IN PYTHON PART-2
LIST IN PYTHON PART-2
 
Python data type
Python data typePython data type
Python data type
 

More from Sugnan M

Python files 11_12_2020
Python files 11_12_2020Python files 11_12_2020
Python files 11_12_2020Sugnan M
 
Python dictionary 02_11_2020
Python dictionary 02_11_2020Python dictionary 02_11_2020
Python dictionary 02_11_2020Sugnan M
 
Python command line_14_12_2020
Python command line_14_12_2020Python command line_14_12_2020
Python command line_14_12_2020Sugnan M
 
Multi threading 04 1_2021
Multi threading 04 1_2021Multi threading 04 1_2021
Multi threading 04 1_2021Sugnan M
 
Exceptions 14 12_2020
Exceptions 14 12_2020Exceptions 14 12_2020
Exceptions 14 12_2020Sugnan M
 
Modules 17 12_2020
Modules 17 12_2020Modules 17 12_2020
Modules 17 12_2020Sugnan M
 
Structures unions
Structures  unionsStructures  unions
Structures unionsSugnan M
 

More from Sugnan M (7)

Python files 11_12_2020
Python files 11_12_2020Python files 11_12_2020
Python files 11_12_2020
 
Python dictionary 02_11_2020
Python dictionary 02_11_2020Python dictionary 02_11_2020
Python dictionary 02_11_2020
 
Python command line_14_12_2020
Python command line_14_12_2020Python command line_14_12_2020
Python command line_14_12_2020
 
Multi threading 04 1_2021
Multi threading 04 1_2021Multi threading 04 1_2021
Multi threading 04 1_2021
 
Exceptions 14 12_2020
Exceptions 14 12_2020Exceptions 14 12_2020
Exceptions 14 12_2020
 
Modules 17 12_2020
Modules 17 12_2020Modules 17 12_2020
Modules 17 12_2020
 
Structures unions
Structures  unionsStructures  unions
Structures unions
 

Recently uploaded

Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 

Recently uploaded (20)

Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 

Python list 28_10_2020

  • 1. BVRIT HYDERABAD College of Engineering for Women Python Programming By M Dyva Sugnana Rao Asst. Professor Department of Computer Science and Engineering
  • 2. BVRIT HYDERABAD College of Engineering for Women Name of the Course Python Programming Course Code CS601PC Year & Semester B.Tech VI Year I Sem Section CSE - A Name of the Faculty M Dyva Sugnana Rao Lecture Hour | Date 02 | 28 October 2020 Name of the Topic List’s Course Outcome(s) Explore about List’s
  • 3. The List Data Type A list is a value that contains multiple values in an ordered sequence. Square bracket, []. Values inside the list are also called Items. Ex: List1 = [1 , 2 , 3 , 4] Lst2 = [12.5 , 6.7 , 8.9] Lst = [‘asd’ , ’fgh’ , ’ghkgjj’] List = [12 , ‘cat’ , 12.5,7,89999,’fghh’]
  • 4. List with Indexes Ex: List = [‘cat’ , ‘rat’ , ‘bat’, ‘mat’] List[0] List[1] List[3] List[5] IndexError: list index out of range List[1.0] TypeError: list indices must be integers, not float
  • 5. Lists can also contain other list values. List = [ ['cat', 'bat'], [10, 20, 30, 40, 50] ] List[0] List[1] List[0][1] List[1][2]
  • 6. Negative Indexes The integer value -1 refers to the last index in a list. List = ['cat', 'bat', 'rat', 'elephant'] List[-1] List[-2]
  • 7. Getting Sublists with Slices Index can get a single value from a list, a slice can get several values • List[2] is a list with an index (one integer). • List[1:4] is a list with a slice (two integers).
  • 8. Getting a List’s Length with len() List = ['cat', 'dog', 'moose'] Len(list)
  • 9. Changing Values in a List with Indexes List = ['cat', 'bat', 'rat', 'elephant'] List [1] = ‘dog’ List[2]= List[1]
  • 10. List Concatenation and List Replication Removing Values from Lists with del Statements List = ['cat', 'bat', 'rat', 'elephant'] Del List[2] Del List[2]
  • 11. Using for Loops with Lists for i in [0, 1, 2, 3]: print(i)
  • 12. sort() Method List = [2, 5, 3.14, 1, -7] List.sort() List.sort(reverse.true) Observations: List= List.sort() List= [1, 3, 2, 4, 'Alice', 'Bob'] List = ['Alice', 'ants', 'Bob', 'badgers', 'Carol', 'cats']
  • 13. BVRIT HYDERABAD College of Engineering for Women Thankyou