Python Programming
Control flow, functions, sequences & dictionaries, regex, OOP design, and scientific libraries NumPy & Pandas.
Module I: Introduction to Python
Features of Python, dynamic typing, operators, input/output, and fundamental data types.
Click Any Topic Below to Open Rendered LaTeX Study Note:
1. Python Execution Pipeline
When a Python script program.py executes:
- Source Code Parsing: Source is parsed into an Abstract Syntax Tree (AST).
- Bytecode Compilation: Compiled into platform-independent intermediate bytecode (
.pycstored in__pycache__). - Python Virtual Machine (PVM): The PVM executes bytecode instructions using an evaluation loop.
2. Everything is an Object & Memory References
In Python, variables do not store values directly; they store memory references (pointers) to objects created in the heap memory:
3. Mutability vs Immutability
- Immutable Types:
int,float,str,tuple,frozenset,bool. Modifying them creates a completely new object in memory. - Mutable Types:
list,dict,set,bytearray. Can be modified in place without changing memory address (id()).
1. Core Concept & Mathematical Formulation — Variables, Expressions & Operators
Unit Context: Module I: Introduction to Python (Arithmetic, relational, logical, bitwise, identity (is), and membership (in) operators.).
The governing relation and analytical representation for Variables, Expressions & Operators is expressed as:
2. Step-by-Step University Exam Derivation
- State the Governing Assumptions: Identify boundary conditions, linearity, and conservation invariants.
- Apply the Fundamental Operator: Substitute the system parameters into the canonical equation:
- Evaluate Limiting Cases: Verify dimensional consistency and asymptotic complexity O(n log n).
3. Verified Implementation & Numerical Example
1. Core Concept & Mathematical Formulation — Standard I/O & Type Casting
Unit Context: Module I: Introduction to Python (input(), print() with sep/end, implicit vs explicit type casting (int, float, str).).
The governing relation and analytical representation for Standard I/O & Type Casting is expressed as:
2. Step-by-Step University Exam Derivation
- State the Governing Assumptions: Identify boundary conditions, linearity, and conservation invariants.
- Apply the Fundamental Operator: Substitute the system parameters into the canonical equation:
- Evaluate Limiting Cases: Verify dimensional consistency and asymptotic complexity O(n log n).