A clean, comprehensive collection of solutions to core Python and NumPy programming challenges. This repository focuses on writing optimized, readable code for algorithm practice, data structure manipulation, and vectorized array calculations without relying on external libraries.
This repository contains a single Jupyter Notebook (DA_DS_WEEK1_ASSIGNMENT_5.ipynb) that covers fundamental to advanced concepts in Python and NumPy. The exercises are structured into three logical sections:
- Section A: Theoretical Foundations β Deep-dive analysis of memory references, mutable vs. immutable types, floating-point arithmetic errors, and hash-table performance.
- Section B: Code Execution & Output Prediction β Demonstrations of shallow copying, mutable default parameters, scoping rules, and short-circuit evaluation.
- Section C: Algorithmic Implementation β Implementations of core computer science algorithms and mathematical models from scratch.
- Arithmetic & Type Parsing: Value swapping methods (XOR, arithmetic, unpacking), and dynamic type detection.
- Logic & Slab Calculations: Income tax and electricity bill slab-based calculators.
- Pattern Generations: Loop-driven numerical and string-based nested patterns (diamonds, hollow squares, Pascal's Triangle).
- Armstrong Numbers: Check digit powers without string conversion.
- Fibonacci & Primes: Non-recursive Fibonacci sequences and optimized prime number evaluations.
- Euclidean Algorithm: GCD/HCF and LCM calculations without using built-in libraries.
- Single-Pass String Scanner: Counts characters, words, vowels, consonants, digits, spaces, and special symbols in a single iteration.
- Custom Array Operations: Finding maximum, minimum, average, and second-highest elements without sorting.
- CRUD Menu Simulator: Pre-populated database dictionary operations.
- Set Operations: Intersection, union, difference, and symmetric difference challenges.
- Custom Duplicates Counter: List analysis without importing
Counter. - Ciphers & Formatting: Caesar Cipher encryption and manual title casing.
- Recursive Math: Custom power function handling negative exponents.
- NumPy Vectorization: Creating, transposing, and tracing identity matrices.
- Loop-Free Slicing: Modifying multi-dimensional borders and extracting sub-arrays without explicit loops.
Make sure you have Python 3.x and the required libraries installed:
pip install numpy jupyter