Python Basics — Lists

less than 1 minute read

Lists

Lists are Python’s most versatile data structure — ordered, mutable collections that can hold any type of data.

What You’ll Learn

Topic Description
Creating & Accessing Lists Build lists and access elements
List Methods append, sort, remove, and more
List Slicing Extract and modify portions
List Comprehensions Elegant one-line list creation
Nested Lists Lists inside lists (2D data)
Practice Exercises Test your skills

Quick Preview

fruits = ["apple", "banana", "cherry"]

fruits.append("date")
fruits.sort()

print(fruits)       # ['apple', 'banana', 'cherry', 'date']
print(fruits[0])    # apple
print(len(fruits))  # 4

Lists are mutable — you can add, remove, and change elements after creation. This makes them fundamentally different from strings and tuples.


Start Learning: Creating & Accessing Lists →

Updated: