Python for Data Analytics • Lesson 7
Lists
Learn how Python lists store multiple values, access items, modify data, add and remove elements, sort information and process collections of data.
0 of 8 concepts completed
Complete the activity and related MCQ to unlock the next concept.
What Is a List?
A list is a collection of values stored in a single variable. Lists use square brackets [ ], and can hold strings, numbers and other data types together.
Learn by Seeing
Square brackets hold many values
students = ["Aman", "Riya", "Rahul"] prices = [500, 750, 1200, 900] print(students[0]) # Aman
One variable, many values — the values keep their order.
A list holds multiple values. Edit the comma-separated items:
your list
Each item gets its own index starting at 0.
Interactive Activity
How many values are stored in prices = [500, 750, 1200, 900]?
Hint: Count the items inside the brackets.
Python Analyst Mindset
Lists are how Python holds your data
Before you can compute averages, find the top value, or clean a dataset, you need to hold a group of values somewhere. Lists are that container — the fundamental shape in which analysts store a column of data.
Store
Hold many values in one name.
Read
Index items with [i] or [-1].
Change
append, insert, remove, pop.
Analyze
len, sort, in.
Frequently Asked Questions
Lists — FAQs
append always adds at the end. insert(i, x) adds at a specific position, shifting other items right.
remove(value) targets a value. pop() targets a position (default last) and returns the removed item.
Yes. sort() sorts the list in place. Use sorted(list) if you want a new sorted copy and to leave the original untouched.
Indexing starts at 0, so a list of length N has valid indexes 0..N-1. Using list[-1] avoids needing to know the length.
Lesson Summary
What you learned
Lists hold multiple values in one variable.
Start at 0; -1 refers to the last item.
Assign to a position to replace the value.
Add or remove items by value or position.
Count and order items.
Checks whether a value exists in a list.