From First Line to First Paper
Mastering Python, Statistical Data Science, and Applied Deep Learning
Preface

Who this book is written for
This book makes no assumptions about prior programming experience. Whether you are a public health student opening a coding environment for the first time, a biostatistician moving from SPSS or Stata to Python, or a quantitative researcher who wants to understand every equation and line of code from first principles, each chapter builds step by step without skipping a link in the chain.
By the end of Part VII, you will move beyond Python syntax to work like a disciplined research software engineer and applied machine learning scientist — taking raw epidemiological or clinical datasets through survey cleaning, leakage-free pipelines, PyTorch architectures, systematic ablation studies, subgroup fairness audits, and reproducible research releases.
How the dual-synced book and Google Colab ecosystem works
Every chapter in this book is paired 1-to-1 with interactive Google Colab notebooks stored across two mirrored hubs:
- GitHub repository (live Colab links): github.com/sharukh01621/first-line-to-first-paper
- Google Drive mirror (full curriculum and datasets): Open shared Google Drive folder
- Walkthrough notebook (
01_walkthrough.ipynb): Every code snippet and “Break It On Purpose” error lab printed in the chapter verbatim. - Guided to-do notebook (
02_guided_todos.ipynb): Hands-on exercises with# YOUR CODE HEREslots, 3-tier progressive hints (tutor.hint(..., level=1..3)), and diagnostic checks (tutor.check(...)) powered by the open-source PyPI packagesharukh-tutor(pip install sharukh-tutor). - Chapter coding exam (
03_coding_exam.ipynb): A 100-point chapter assessment graded automatically withtutor.check_exam(...). - Annotated solution notebooks (
solutions/.../*_SOLUTION.ipynb): Complete worked solutions paired with debugging post-mortems explaining common mistakes and how to avoid them.
Quick-start onboarding hub
| Onboarding lab | Interactive Google Colab launch link | Scan (print) |
|---|---|---|
| Curriculum index | 00_START_HERE.ipynb | ![]() |
| 2-minute setup | 00_setup / 00_colab_orientation.ipynb | ![]() |
Before starting Chapter 1, open the Colab Orientation Notebook (00_setup/00_colab_orientation.ipynb), select File \(\rightarrow\) Save a copy in Drive, and run its three welcome cells to verify your runtime and preview the bundled public health spine datasets.
The researcher’s 4-step problem-structuring blueprint
Beginners often freeze at a blank code cell because they try to write Python syntax before designing the logic. Across all 36 chapters, before writing code for any non-trivial problem, we complete four steps:
- Inputs and units: What exact values enter the problem, what data types are they, and what units (kg, cm, mmHg, per 100,000) do they carry?
- Edge cases and traps: What could silently go wrong — zero denominators, missing survey sentinel codes such as
999, operator precedence mistakes, floating-point truncation, or data leakage? - Step-by-step algorithm: Plain-English ordered steps written before Python.
- Verification plan: Hand-calculated or domain-bounded sanity checks proving the output makes scientific sense.
Visual callout legend
- Mental Model (
Note): Diagrams and analogies showing what happens inside Python’s memory and interpreter. - Researcher’s Note (
Tip): Statistical, epidemiological, and reproducible-science best practices. - Common Trap (
Warning): Subtle bugs that run without crashing and silently corrupt analyses. - Break It On Purpose (
Important): Controlled experiments that trigger real Python errors so you learn to read tracebacks calmly.
Master 7-part curriculum roadmap (First edition, 860 pages)
| Part | Chapters | Core mastery milestone | Pages |
|---|---|---|---|
| Part I | Ch 1–6 | Computational thinking and Python from absolute zero | 110 |
| Part II | Ch 7–11 | Core data structures, algorithms, and defensive programming | 105 |
| Part III | Ch 12–15 | OOP, Jupyter/Colab engineering, VS Code, and Git | 90 |
| Part IV | Ch 16–20 | NumPy, Pandas, survey cleaning, visualization, and biostatistics | 115 |
| Part V | Ch 21–26 | Classical machine learning from scratch math to leakage-free pipelines | 140 |
| Part VI | Ch 27–32 | Deep learning from NumPy backprop to PyTorch, CNNs, and Transformers | 145 |
| Part VII | Ch 33–36 | Rigorous experiments, ablation studies, fairness, and capstone paper | 115 |
| Appendices | A–E | Cheat sheets, math refresher, Top-50 error decoder, Colab index, and references | 50 |

