Python Lists Explained with 6 Beginner Examples

⏱ 6 min read · Skill: Beginner

Last Updated: August 2025


Ever wanted to store multiple things — like your top 5 snacks — in one place? That’s exactly what Python lists do. Think of them like boxes that can hold anything: numbers, text, even other boxes!



What’s a List in Python?

Lists are ordered collections. You can change them, grow them, shrink them, sort them — super flexible. And they’re written using square brackets like [ ].


Example 1: Creating a List

Python

fruits = ["apple", "banana", "mango"]
print(fruits)
 

🔹This creates a list of fruits. Pretty straightforward, right?


Example 2: Accessing Items

Python

print(fruits[0])  # apple
print(fruits[-1]) # mango
 

🔹Use indexes to grab specific items. Index 0 is the first item, and -1 gives you the last one.


Example 3: Adding to the List

Python

fruits.append("orange")
print(fruits)
 

🔹append() sticks something at the end. There’s also insert() if you want to sneak it in somewhere specific.


Example 4: Removing Items

Python

fruits.remove("banana")
print(fruits)
 

🔹Say goodbye to “banana”! You can also use pop() or del depending on what you're trying to do.


Example 5: Looping Through a List

Python

for fruit in fruits:
    print(fruit)
 

🔹This will print each fruit one at a time. Perfect for when you want to do something with every item.


Example 6: Sorting the List

Python

numbers = [4, 1, 9, 3]
numbers.sort()
print(numbers)  # [1, 3, 4, 9]
 

🔹sort() organizes things in-place. Use sorted() if you don’t want to mess with the original list.



Why Should You Learn Lists?




Ready to Practice?


Try this mini challenge: Create a list of your favorite movies, add two more, remove one, then print them all with a for loop. You’ll be surprised how easy it gets!



Want to level up? Try our beginner mini project: Build a Random Password Generator