0% found this document useful (0 votes)
9 views6 pages

Python Lists: Creation and Operations

Lists in Python are ordered, mutable collections created using square brackets, capable of storing various data types. They allow access to elements via indexing and support operations such as appending, removing, inserting, and popping elements. Lists are widely used in real-life applications like shopping lists, student marks, and to-do lists.

Uploaded by

kummaricharan10
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views6 pages

Python Lists: Creation and Operations

Lists in Python are ordered, mutable collections created using square brackets, capable of storing various data types. They allow access to elements via indexing and support operations such as appending, removing, inserting, and popping elements. Lists are widely used in real-life applications like shopping lists, student marks, and to-do lists.

Uploaded by

kummaricharan10
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Lists in Python

Ch. Arun
23007-CS-026
Lists
• List is a ordered collection of
elements
• Lists are created by using Square
brackets[]
• Mutable Datatype
• Lists can store different types of
Elements
Ex:- int , float , string, another list
Creating a
• Numbers List
= [1,2,3,4]
• Names = [“Arun” , “Charan” ,
“Krishna”]

Accessing List Elements:


• List elements are accessed using
index
Ex: Number[1]
List Operations
append( ) remove(value)
Removes the first occurance of the value
Add one element at the end
Ex: list = [2,3] Ex: list=[1,2,3,2]
[Link](3) [Link](2)
print(list) print(list)
Output: [1,2,3] Output: [1,3,2]

insert(index,element) pop(index)
Removes and returns elements at index
Adds element at the specific
position Ex: list=[10,20,30]
Ex: list=[1,2,4] [Link](1)
[Link](2,3) print(list)
print(list) Output: [10,30]
Output: [1,2,3,4]
Real Life Applications
• Shopping List
• Student Marks
• Packing Checklist
• To-do list
Conclusion
• Lists are an important and
flexible data structure in
Python.
• They are used to store,
manage, and manipulate
multiple values efficiently.

You might also like