VOOZH about

URL: https://www.geeksforgeeks.org/python/access-list-items-in-python/

⇱ Access List Items in Python - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Access List Items in Python

Last Updated : 23 Jul, 2025

Accessing elements of a list is a common operation and can be done using different techniques. Below, we explore these methods in order of efficiency and their use cases. Indexing is the simplest and most direct way to access specific items in a list. Every item in a list has an index starting from 0.


Output
10
50

Other methods that we can we use to access list elements are :

Using List Comprehension

List comprehension is a more advanced and efficient way to access list items. It allows us to create a new list based on an existing list by applying a condition or transformation.


Output
[30, 40, 50]

Using List Slicing

Slicing is another way to access multiple items from a list. We can get a range of items by specifying a starting index and an ending index. The starting index is included, but the ending index is not.


Output
[20, 30, 40]

Using Loop

Sometimes we need to access all the items in the list, and for that, a loop is useful. A for loop lets us go through each item in the list one by one.


Output
10
20
30
40
50
Comment
Article Tags:
Article Tags: