This project explores Python's four fundamental built-in data structures: Lists, Tuples, Sets, and Dictionaries. Through targeted hands-on exercises, this repository demonstrates how to select and apply the right container type based on data mutability, uniqueness requirements, key-value lookup needs, and aggregation requirements across real-world business scenarios.
Data analysts frequently process heterogeneous datasets requiring different memory structures and operational rules.
Without using the appropriate data structure:
- Data Corruption: Fixed system values (like calendar months) risk being accidentally overwritten if stored in mutable collections.
- Duplicate Overhead: Customer loyalty lists accumulate redundant entries, artificially inflating metrics and slowing database queries.
- Lookup Inefficiencies: Searching through tabular lists for specific record attributes (such as employee details) requires costly iteration instead of direct key lookups.
This project addresses these challenges by implementing Lists for ordered tracking, Tuples for immutable standards, Sets for automatic deduplication, and Dictionaries for structured entity mapping.
- Healthcare Patient Management: Uses mutable Lists to maintain chronological patient queues and dynamically register walk-in admissions using
.append(). - Academic & Administrative Record Systems: Uses immutable Tuples to protect static calendar structures (12 examination months) against accidental runtime modifications.
- Retail & Customer Loyalty Programs: Utilizes Sets to automatically purge duplicate customer IDs from transaction logs, ensuring accurate unique visitor analytics.
- HR Information Systems (HRIS): Employs Dictionaries to map key-value attributes (Employee ID, Name, Department, Salary) for fast profile lookups.
- Sales Analytics & Executive Dashboards: Leverages List aggregation functions (
sum(),max(),min(),len()) to compute total revenue, regional performance, and branch expansions.
- Core Language: Python 3.x
- Development Environment: Jupyter Notebook / JupyterLab
- Core Data Structures & Functions Applied:
- Lists (
[]): Dynamic ordered sequences (.append(),len(),sum(),max(),min()) - Tuples (
()): Immutable ordered sequences for fixed data protection - Sets (
{}): Unordered collections of unique elements for automatic deduplication - Dictionaries (
{key: value}): Fast key-value pair mapping for structured records
- Dynamic Queue Operations: Managed append operations on ordered lists to modify live registration queues.
- Immutability Enforcement: Applied tuples to preserve static reference data against accidental modification or programmatic deletion.
- Automatic Set Deduplication: Leveraged hashing behavior in Python sets to eliminate repetitive ID entries from raw logging streams instantly.
- Key-Value Data Modeling: Structured multi-attribute entity cards using dictionaries for direct key access (
employee["Department"]). - Numerical Aggregation Pipelines: Executed mathematical calculations across list structures using native built-in functions to evaluate total revenue and operational extremes.
Managed a patient admission log (['James', 'Sarah', 'David', 'Grace', 'Esther']):
- Tracked queue size using
len(). - Registered a new admission (
Michael) usingpatients.append(). - Displayed real-time updated registration lists.
Stored the 12 calendar months (('January', 'February', ..., 'December')) in a tuple:
- Evaluated collection length using
len(). - Documented immutability rules to explain why tuples prevent accidental addition, deletion, or modification during academic reporting cycles.
Processed a raw transaction log containing repetitive customer IDs ([101, 205, 101, 310, 450, 205, 512, 310, 620]):
- Stored entries in a set (
customer_id) to automatically strip duplicates. - Calculated unique customer reach (reducing 9 raw records down to 6 unique IDs).
Created a structured profile dictionary for Sophia Johnson (EMP001):
- Defined attributes including
Name,Department(Finance),Position(Data Analyst),Salary(6500), andEmployment Status. - Executed targeted key queries to extract isolated fields (
DepartmentandSalary).
Analyzed regional branch revenue figures ([2500, 3200, 4100, 2800, 3900, 3500]):
- Calculated total active branches (
len()). - Extracted peak sales (
max() = 4100) and lowest sales (min() = 2500). - Computed total cumulative revenue (
sum() = 20000). - Expanded branch coverage by appending new sales data (
4700) and recalculating metrics across 7 branches.
==================== HOSPITAL PATIENT REGISTRATION ====================
Patients: ['James', 'Sarah', 'David', 'Grace', 'Esther']
Length: 5
Updated Patients: ['James', 'Sarah', 'David', 'Grace', 'Esther', 'Michael']
==================== UNIVERSITY EXAM RECORDS ====================
Months: ('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December')
Length: 12
==================== CUSTOMER LOYALTY PROGRAM ====================
Customer IDs: {512, 450, 101, 310, 620, 205}
Unique Customer Count: 6
==================== EMPLOYEE INFORMATION CARD ====================
Department: Finance
Salary: 6500
==================== SALES PERFORMANCE DASHBOARD ====================
Total Number of Branches: 6
Highest Sales: 4100 | Lowest Sales: 2500
Total Cumulative Sales: 20000
New Branch List: [2500, 3200, 4100, 2800, 3900, 3500, 4700]
Updated Total Branches: 7