Intermediate Python

Data & File Systems

Module 2: Moving from variables to permanent storage and advanced data manipulation.

SYSTEM: FILE_IO

11 // File Handling: Permanent Memory

Variables vanish when a program closes. To keep data forever, we must write to files. We use the with statement for safe handling.

# Writing to a text file with open("database.txt", "w") as file: file.write("User_ID: 001\nStatus: Active") # Reading from a file with open("database.txt", "r") as file: content = file.read() print(content)
AI Insight: Using 'with' is a Pythonic best practice. It automatically closes the file for you, even if the code crashes, preventing memory corruption.

SYSTEM: LIST_COMPREHENSION

12 // List Comprehensions

A powerful, one-line way to create lists. This is a signature feature of advanced Python developers.

# Traditional Way numbers = [1, 2, 3, 4] squares = [] for n in numbers: squares.append(n * n) # Pythonic Way (List Comprehension) squares = [n * n for n in numbers]

SYSTEM: STRING_METHODS

13 // Advanced String Manipulation

Cleaning and formatting data for reports or user interfaces using .strip(), .split(), and .join().

raw_data = " Lagos, Nigeria " clean_data = raw_data.strip().upper() # Result: "LAGOS, NIGERIA"

SYSTEM: TIME_MODULE

14 // Working with Time

Using the datetime module to track logs, timestamps, and transaction histories.

from datetime import datetime now = datetime.now() print(f"Current Timestamp: {now.strftime('%Y-%m-%d %H:%M')}")

SYSTEM: INTERMEDIATE_CONCEPTS

15-19 // Memory & Data Integrity

Lesson 15: *args and **kwargs — Handling dynamic numbers of function inputs.

Lesson 16: Lambda Functions — Writing anonymous, one-line functions for logic tasks.

Lesson 17: Set & FrozenSet — Handling unique data entries (no duplicates allowed).

Lesson 18: Deep Copy vs. Shallow Copy — Managing how Python copies data objects in memory.

Lesson 19: Recursion — Functions that call themselves to solve complex mathematical patterns.


CAPSTONE_PROJECT_02

20 // Project: The Secure Logger

Build a system that takes user input, sanitizes the text, and saves it to a permanent file with a timestamp.

🌍 MARKET APPLICATION In the African market, local businesses need "Lightweight CRM" systems. This project is the foundation for a tool that tracks customer sales without needing a heavy, expensive database.
START MODULE 03: OBJECTS & CLASSES →