Programming with Python

  1. Home
  2. Docs
  3. Programming with Python
  4. Lists in python
  5. Working with lists in python

Working with lists in python

Working with python means basic three operations on lists i.e. appending, updating and deleting elements in list.

Appending elements to a list:-

It means adding elements at the end of the list. We can do this with the help of a function append().


a=[10, 12, 22, 26]
Output- [10,12,22,26,30]

Updating elements to a list:-

To update or change an element in a list in place, we have to assign new value to the element’s index in the list.


a=[10, 12, 16, 20, 24]
Output- [10, 12, 18, 20, 24]

Deleting elements from a list:-

For deleting elements from a list we use del() function in python. We write the index of the element we have to delete in bracket and then delete it.


a=[1, 2, 3, 4, 5, 6]
del a[3]
Output- [1, 2, 3, 5, 6]

This is all about working with lists in python.

Was this article helpful to you? Yes No

How can we help?