Category

Python

A series following the 42 “Array” module — each post unpacks the core concept behind one exercise, from plain lists all the way to image color filters.

  1. ex00Lists, NumPy Arrays & Vectorized OperationsWhy Python lists are not arrays, how NumPy changes the game, and how to compute a BMI vector with clean type and shape error handling.pythonnumpyarraysdatascience9 min
  2. ex012D Arrays: Shape, Axes & SlicingHow a 2D array is really a list of rows, what .shape actually measures, and how slicing lets you carve out sub-arrays without copying data element by element.pythonnumpyslicing2d-array8 min
  3. ex02Images Are Just Arrays: Loading RGB PixelsAn image is a 3D array of numbers. Learn how height, width and color channels map onto a NumPy shape, and how to load a JPEG into pixel data safely.pythonnumpyimagespillow8 min
  4. ex03Zoom In: Cropping Images with Slicing & MatplotlibZooming is just cropping plus display. Learn how to slice a region of interest out of an image array and render it with scaled axes using matplotlib.pythonnumpymatplotlibimages7 min
  5. ex04Transpose by Hand: Rotating an Image Without a LibraryThe transpose swaps the axes of an array. Learn what it does geometrically, why the subject bans np.transpose here, and how to implement it yourself with nested loops.pythonnumpytransposeimages8 min
  6. ex05Pimp My Image: Color-Channel Filters from ScratchInvert, isolate red/green/blue, and grayscale — five filters built only from arithmetic on the RGB channels, each constrained to a tiny set of operators.pythonnumpyimagescolor9 min