Tutorials

Tutorials

Practical, hands-on tutorials and how-to guides on Python, Pandas, NumPy, SQL, and setting up your data-science environment.

Python

Build an AI Chatbot in Python: A Command-Line LLM Client

A from-scratch walkthrough of the pattern behind every LLM chatbot: one function that sends a message plus conversation history to a chat-completion API, a persona set by a system prompt, and a loop that keeps the conversation going.

July 3, 2026 · 10 min read ·By Mehdi Lotfinejad Read tutorial →
Software Engineering The Single Responsibility Principle: One Class, One Reason to Change The Single Responsibility Principle says a class should have only one reason to change. See it in action: take a Python AuthService that also owns its logging, find why that's a problem, and refactor it into clean, focused classes. Jun 28, 2026 4 min read Read tutorial Python Calling Web APIs in Python: GET Requests, JSON, and Status Codes A hands-on introduction to the requests library: make a real GET request to a live API, read the JSON response into Python, shape the request with query parameters, and check status codes before trusting the result. Jul 5, 2026 10 min read Read tutorial Python Docker and Jupyter: Building a Reproducible Data Science Environment Tired of a notebook that only runs on your machine? This guide builds the container mental model, then walks through pulling a real Jupyter image, mounting a volume so your work survives, and reaching the server from your browser. Jul 5, 2026 10 min read Read tutorial Python Dominant Colors in an Image: Clustering Pixels with K-Means A first taste of unsupervised learning: there's no label to predict here, just raw pixel data. This post reshapes an image into a table of RGB points, clusters them with scikit-learn's KMeans, and reads the cluster centers back as the image's dominant colors and their prevalence. Jul 5, 2026 11 min read Read tutorial Python Python Data Structures: Lists, Tuples, Sets, or Dicts? Python gives you four built-in ways to hold a group of values, and picking the wrong one causes bugs down the line. This guide builds a three-question decision tree, then walks through lists, tuples, and sets in depth on one running example, with a side-by-side comparison table to keep them all straight. Jul 5, 2026 11 min read Read tutorial Python Python subprocess: Run Commands, Capture Output, and Handle Failures Safely Running another program from Python means dealing with output, exit codes, and safety all at once. This guide builds the mental model for subprocess.run(), then works through capturing output, checking return codes with check=True, and why list-based arguments beat a shell=True string. Jul 5, 2026 11 min read Read tutorial Python Cleaning Messy Data with Pandas: A Practical Guide Real datasets are never as clean as tutorial datasets. This guide builds a detect-decide-fix workflow for pandas, then applies it to a real, freely-licensed museum collection dataset — missing values, disguised placeholders, inconsistent text, duplicates, and messy dates included. Jul 3, 2026 12 min read Read tutorial Statistics Descriptive Statistics in Python: A Practical Guide to Center and Spread A practical walkthrough of descriptive statistics in Python: measures of center, measures of spread, and percentiles, computed with pandas and NumPy on a real restaurant tipping dataset. Jul 3, 2026 9 min read Read tutorial Python Matplotlib, Seaborn, or Plotly? A Practical Guide to Picking a Chart Library Matplotlib, seaborn, pandas' .plot(), and plotly all draw charts from the same DataFrame. This guide builds a mental model for choosing between them, then plots the same restaurant-tips data three different ways so you can see exactly what each one buys you. Jul 3, 2026 11 min read Read tutorial
Sponsor

Keep DATATWEETS free. Help fund practical data, AI, and engineering lessons for learners worldwide.

Buy Me a Coffee at ko-fi.com