[ lists ]
Defining Lists
* First, you define a list of five elements. Note that they retain their original order. This is not an accident. A listis an ordered set of elements enclosed in square brackets.** A list can be used like a zero−based array. The first element of any non−empty list is always names [0].*** The last element of this five−element list is names [4], because lists are always zero−based.
Negative List IndicesSlicing a List
Slicing Shorthand* If the left slice index is 0, you can leave it out, and 0 is implied. So colours[:3] is the same as  colours[0:3]** Similarly, if the right slice index is the length of the list, you can leave it out. So colours[3:] is the same as colours[3:5], because this list has five elements.
Adding Elements to Lists.appendappend adds a single element to the end of the list..extendextend concatenates lists..insertinsert inserts a single element into a list.
example
The Difference between extend and append
Lists
Good Luke  By \ salma subh 

More Related Content

PPT
Spreadsheet Features
PDF
Liste euro3
PPTX
listppt.pptx h4wtgesvzdfvgsrbyhrrtgsvefcdef
PPTX
Lists on the pyhton to learn the children more easily on easy codes.pptx
PPTX
list.pptx
PDF
Data type list_methods_in_python
Spreadsheet Features
Liste euro3
listppt.pptx h4wtgesvzdfvgsrbyhrrtgsvefcdef
Lists on the pyhton to learn the children more easily on easy codes.pptx
list.pptx
Data type list_methods_in_python

Similar to Lists (20)

PPTX
Pythonlearn-08-Lists.pptx
PDF
Py4Inf-08-Lists ListsListsListsListsListsListsListsListsListsListsListsLists.pdf
PDF
Python elements list you can study .pdf
PDF
FINAL revised LIST in Python.pdf
PPTX
lists_list_of_liststuples_of_python.pptx
PDF
Python list manipulation basics in detail.pdf
PDF
List in Python Using Back Developers in Using More Use.
PPTX
Pythonlearn-08-Lists for fundatmentals of Programming
PPTX
Python-List.pptx
KEY
Programming with Python - Week 2
PPTX
Chapter 15 Lists
PDF
"Automata Basics and Python Applications"
PDF
Python lists
PPTX
Pythonlearn-08-Lists.pptx
PPTX
Mastering Python lesson 5a_lists_list_operations
PDF
List , tuples, dictionaries and regular expressions in python
PPTX
Python _dataStructures_ List, Tuples, its functions
PPTX
Pythonlearn-08-Lists (1).pptxaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
PDF
PPTX
Presentation python programming vtu 6th sem
Pythonlearn-08-Lists.pptx
Py4Inf-08-Lists ListsListsListsListsListsListsListsListsListsListsListsLists.pdf
Python elements list you can study .pdf
FINAL revised LIST in Python.pdf
lists_list_of_liststuples_of_python.pptx
Python list manipulation basics in detail.pdf
List in Python Using Back Developers in Using More Use.
Pythonlearn-08-Lists for fundatmentals of Programming
Python-List.pptx
Programming with Python - Week 2
Chapter 15 Lists
"Automata Basics and Python Applications"
Python lists
Pythonlearn-08-Lists.pptx
Mastering Python lesson 5a_lists_list_operations
List , tuples, dictionaries and regular expressions in python
Python _dataStructures_ List, Tuples, its functions
Pythonlearn-08-Lists (1).pptxaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
Presentation python programming vtu 6th sem
Ad

Recently uploaded (20)

PPTX
GROUP4NURSINGINFORMATICSREPORT-2 PRESENTATION
PDF
4 layer Arch & Reference Arch of IoT.pdf
PDF
Advancing precision in air quality forecasting through machine learning integ...
PDF
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
PDF
sbt 2.0: go big (Scala Days 2025 edition)
PDF
Statistics on Ai - sourced from AIPRM.pdf
PDF
Taming the Chaos: How to Turn Unstructured Data into Decisions
PDF
INTERSPEECH 2025 「Recent Advances and Future Directions in Voice Conversion」
PDF
The-Future-of-Automotive-Quality-is-Here-AI-Driven-Engineering.pdf
PDF
Co-training pseudo-labeling for text classification with support vector machi...
PPTX
future_of_ai_comprehensive_20250822032121.pptx
PDF
Produktkatalog für HOBO Datenlogger, Wetterstationen, Sensoren, Software und ...
PDF
Auditboard EB SOX Playbook 2023 edition.
PDF
Comparative analysis of machine learning models for fake news detection in so...
PDF
AI.gov: A Trojan Horse in the Age of Artificial Intelligence
PDF
Improvisation in detection of pomegranate leaf disease using transfer learni...
PDF
sustainability-14-14877-v2.pddhzftheheeeee
PDF
NewMind AI Weekly Chronicles – August ’25 Week IV
PDF
Flame analysis and combustion estimation using large language and vision assi...
PPTX
Module 1 Introduction to Web Programming .pptx
GROUP4NURSINGINFORMATICSREPORT-2 PRESENTATION
4 layer Arch & Reference Arch of IoT.pdf
Advancing precision in air quality forecasting through machine learning integ...
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
sbt 2.0: go big (Scala Days 2025 edition)
Statistics on Ai - sourced from AIPRM.pdf
Taming the Chaos: How to Turn Unstructured Data into Decisions
INTERSPEECH 2025 「Recent Advances and Future Directions in Voice Conversion」
The-Future-of-Automotive-Quality-is-Here-AI-Driven-Engineering.pdf
Co-training pseudo-labeling for text classification with support vector machi...
future_of_ai_comprehensive_20250822032121.pptx
Produktkatalog für HOBO Datenlogger, Wetterstationen, Sensoren, Software und ...
Auditboard EB SOX Playbook 2023 edition.
Comparative analysis of machine learning models for fake news detection in so...
AI.gov: A Trojan Horse in the Age of Artificial Intelligence
Improvisation in detection of pomegranate leaf disease using transfer learni...
sustainability-14-14877-v2.pddhzftheheeeee
NewMind AI Weekly Chronicles – August ’25 Week IV
Flame analysis and combustion estimation using large language and vision assi...
Module 1 Introduction to Web Programming .pptx
Ad

Lists

  • 3. * First, you define a list of five elements. Note that they retain their original order. This is not an accident. A listis an ordered set of elements enclosed in square brackets.** A list can be used like a zero−based array. The first element of any non−empty list is always names [0].*** The last element of this five−element list is names [4], because lists are always zero−based.
  • 5. Slicing Shorthand* If the left slice index is 0, you can leave it out, and 0 is implied. So colours[:3] is the same as colours[0:3]** Similarly, if the right slice index is the length of the list, you can leave it out. So colours[3:] is the same as colours[3:5], because this list has five elements.
  • 6. Adding Elements to Lists.appendappend adds a single element to the end of the list..extendextend concatenates lists..insertinsert inserts a single element into a list.
  • 8. The Difference between extend and append
  • 10. Good Luke  By \ salma subh 