Python Lists – Store and Manage Multiple Values with Simple Examples
Published: 26 Sep, 2026 | Author: CCI Admin | Category: Python / Programming
In Python, a List is used to store multiple values in a single variable. Lists are one of the most commonly used data structures in Python because they are simple, flexible, and easy to manage.
What is a Python List?
A list is a collection of values stored inside square brackets [ ]. A list can contain numbers, strings, or different types of values.
students = ["Arun", "Priya", "Rahul", "Meena"]
print(students)
Output:
['Arun', 'Priya', 'Rahul', 'Meena']
Creating a List
We can create a list by placing multiple values inside square brackets.
numbers = [10, 20, 30, 40, 50]
print(numbers)
Accessing List Elements
List elements can be accessed using their index number. Python starts indexing from 0.
fruits = ["Apple", "Banana", "Mango"]
print(fruits[0])
print(fruits[1])
print(fruits[2])
Output:
Apple
Banana
Mango
Changing List Values
Lists are mutable, which means we can change their values after creating them.
fruits = ["Apple", "Banana", "Mango"]
fruits[1] = "Orange"
print(fruits)
Output:
['Apple', 'Orange', 'Mango']
Adding Elements to a List
The append() method adds a new element to the end of a list.
students = ["Arun", "Priya"]
students.append("Rahul")
print(students)
Output:
['Arun', 'Priya', 'Rahul']
Removing Elements from a List
The remove() method can be used to remove a specific value.
fruits = ["Apple", "Banana", "Mango"]
fruits.remove("Banana")
print(fruits)
Output:
['Apple', 'Mango']
Finding the Number of Elements
The len() function returns the number of elements in a list.
numbers = [10, 20, 30, 40]
print(len(numbers))
Output:
4
Looping Through a List
A for loop can be used to access each element in a list.
students = ["Arun", "Priya", "Rahul"]
for student in students:
print(student)
Output:
Arun
Priya
Rahul
Common Python List Methods
| Method | Purpose |
|---|---|
| append() | Adds an element |
| remove() | Removes a specific element |
| insert() | Adds an element at a specific position |
| pop() | Removes an element by index |
| sort() | Sorts list elements |
| len() | Returns the number of elements |
Real-Life Example
A student management application can use a list to store student names.
students = ["Arun", "Priya", "Rahul", "Meena"]
for student in students:
print("Student:", student)
Lists are useful for storing and managing collections such as student names, marks, product names, prices, employee details, and many other types of data.
Frequently Asked Questions
1. What is a list in Python?
A list is a collection that allows multiple values to be stored in a single variable.
2. Can a Python list contain different data types?
Yes. A list can contain strings, integers, floating-point numbers, and other Python objects.
3. Can we change a list after creating it?
Yes. Python lists are mutable, so their elements can be changed, added, or removed.
Conclusion
Python Lists provide a simple way to store and manage multiple values. By learning indexing, updating, adding, removing, and looping through lists, beginners can start working with collections of data in real-world Python programs.
Related CCI Blogs
- Python Variables and Data Types
- Functions in Python – Learn How to Write Reusable Code with Simple Examples
- Python Conditional Statements – if, elif and else
Contact CCI Computer Education – Pudukkottai
Want to learn Python programming?
Call: 98427 97945 | Website: ccipudukkottai.com
WhatsApp Channel: Join Now
Share: Facebook | WhatsApp | Twitter