Module 02 — Containers: Lists, Dictionaries, Tuples, and Sets#
Graduate MSBA Module Overview
In business analytics, you rarely work with a single piece of data at a time. You work with collections — lists of customers, dictionaries of product information, and sets of unique transaction IDs. Python provides four powerful container types that let you organize, store, and access collections of data efficiently.
- List — Ordered, changeable collection. Perfect for sequences of sales figures or customer names.
- Dictionary — Key-value pairs. Ideal for structured records like a customer profile with names, IDs, and purchase histories.
- Tuple — Ordered, unchangeable collection. Useful for fixed data like geographic coordinates or configuration values.
- Set — Unordered collection of unique values. Powerful for identifying distinct categories or removing duplicates.
Course Connections#
These four containers are the building blocks of data organization in Python. Before you can manipulate data with Pandas or build analytics pipelines, you need to understand how to store and access collections of information. Each container type has strengths suited to specific business problems, and choosing the right one is part of thinking like an analyst.
Quick Code Example#
# List of customer purchase amounts
purchase_history = [250.50, 180.75, 420.25, 310.00, 95.80]
# Dictionary storing a customer profile
customer_profile = {
'name': 'Alice Johnson',
'customer_id': 1001,
'region': 'Northwest',
'is_premium': True
}
# Tuple storing fixed store location coordinates
store_location = (47.6062, -122.3321)
# Set of unique product categories purchased
product_categories = {'Electronics', 'Apparel', 'Electronics', 'Home Goods', 'Apparel'}
total_spent = sum(purchase_history)
average_purchase = total_spent / len(purchase_history)
unique_categories = len(product_categories)
print('Customer:', customer_profile['name'])
print('Total Spent:', total_spent)
print('Average Purchase:', round(average_purchase, 2))
print('Unique Categories Purchased:', unique_categories)
print('Store Coordinates:', store_location)Expected Output:
Customer: Alice Johnson
Total Spent: 1257.3
Average Purchase: 251.46
Unique Categories Purchased: 3
Store Coordinates: (47.6062, -122.3321)Learning Progression#
| Platform | Student Learning Experience |
|---|---|
| NotebookLM | Explore containers through business storytelling that shows how organizing data into the right container type shapes what analysis is possible |
| Google Colab | Create, access, and manipulate lists, dictionaries, tuples, and sets in live Python code |
| Zybooks | Build hands-on mastery through structured exercises that reinforce container operations and data access patterns |
Module Pages#
- Concept → — Deep narrative on containers and when to use each type
- Advanced → — Extended code example with business context
- Notebook → — Jupyter notebook lab description