←Back to Subject
Notes
Notes
Study material and explanations
Diagrams
Diagrams
Visualize concepts easily
Mnemonics
Mnemonics
Tricks to remember faster
One Night Prep
One Night Prep
Short and focused revision
Revision
Revision
Quick summary and key points
Important Questions
Important Questions
Practice most relevant questions
Diagrams

Diagrams

Visual representations for Unit 3

Modular Programming Architecture in Python

Modular Programming Architecture in Python
main.py (Main Application)
↓ imports ↓
calc_module.py
Math Functions
student_db.py
Database Logic
report_gen.py
PDF / Output
Explanation
  • Split related operations into modules with clear names.
  • The main program imports those modules and calls the functions it needs.
Detailed Notes →Quick Revision →

Core Standard Modules in Unit 3

Core Standard Modules in Unit 3
1. math Module
Mathematical functions (square root, trigonometry, logarithms, constants like pi and e).
2. datetime Module
Working with dates, times, timestamps, formatting (strftime), and date arithmetic.
3. os Module
Interacting with the Operating System (folders, file paths, environment variables).
Explanation
  • The os module provides operating-system services and datetime works with dates and times.
  • The math module supplies numerical functions and constants.
Detailed Notes →Quick Revision →

Organizing a Python Project into a Package (college_pkg)

Organizing a Python Project into a Package (college_pkg)
📁 my_project/
├── 📄 main.py                  # Entry point of the application
└── 📦 college_pkg/            # Python Package
    ├── 📄 __init__.py        # Marks this folder as a Python Package
    ├── 📄 students.py        # Module 1: Student admission & records
    ├── 📄 faculty.py         # Module 2: Teacher details
    └── 📄 exams.py           # Module 3: Marks & result calculation
Explanation
  • A package gives related modules a common import path.
  • The directory structure and package initialisation determine how code is organised and found.
Detailed Notes →Quick Revision →

3-Step Lifecycle of File Handling in Python

3-Step Lifecycle of File Handling in Python
1. Open File
f = open("data.txt", "r")
→
2. Read / Write Data
f.read() or f.write()
→
3. Close File
f.close()
Explanation
  • Open the file in a mode suited to the intended operation and use the returned handle.
  • A with block closes it after the read or write, even if an exception interrupts the work.
Detailed Notes →Quick Revision →