{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "d9724920",
   "metadata": {},
   "source": [
    "# Preface"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b76f38c6",
   "metadata": {},
   "source": [
    "This site contains a set of lecture notes (the \"book\") for the Python components of IST-5551, Foundations of Computing and Programming for Data Science, offered by the Jaggi Business School at Missouri S&T in Rolla, Missouri. It was inspired in part by Dr. Allen Downey's [Think Python](https://allendowney.github.io/ThinkPython/) book."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6516d914",
   "metadata": {},
   "source": [
    "## At a Glance\n",
    "\n",
    "Each chapter in this book builds on the previous ones, so you should read them in order and take time to work on the exercises before you move on.\n",
    "\n",
    "- **Part I: Fundamentals**: Core Python concepts such as statements, expressions, operators, built-in data types, conditionals, loops, functions, exceptions, and testing.\n",
    "\n",
    "- **Part II: Data Structures**: Python's main data structures -- lists, tuples, dictionaries, and sets -- along with strings, regular expressions, and text analysis.\n",
    "\n",
    "- **Part III: Program Design**: Object-oriented programming, functional programming, iterators, generators, and APIs.\n",
    "\n",
    "- **Part IV: Algorithms & Data Structures**: Abstract data structures, algorithm design, searching, and sorting.\n",
    "\n",
    "- **Appendices**: Practical setup topics such as tooling, Python installation, virtual environments, Jupyter notebooks, and related workflow tips."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "31fb9e26",
   "metadata": {},
   "source": [
    "## Chapter Topics\n",
    "\n",
    "The chapters progress from Python fundamentals, control flow, functions, and testing to core data structures and text processing, then to program design with objects, functional tools, iterators, and APIs, and finally to abstract data structures and algorithms. Preview, Lab, and Homework activities accompany each chapter.\n",
    "\n",
    "| Chapter | Topics |\n",
    "| --- | --- |\n",
    "| [1. Introduction](chapters/01-intro/0100-py.ipynb) | Natural and formal languages; levels of abstraction; interpreted and compiled languages; expressions and statements; number systems and character encoding; indentation and statement formatting; input, output, and f-strings; built-in functions, modules, and packages. |\n",
    "| [2. Syntax and Types](chapters/02-basics/0200-py-basics.ipynb) | Variables and naming conventions; objects, types, identity, and mutability; aliasing; assignment, arithmetic, and comparison operators; truthiness, membership, and identity; logical and bitwise operators; type checking, conversion, and hinting; strings and collection types. |\n",
    "| [3. Control Flow](chapters/03-control-flow/0300-control-flow.ipynb) | `if`, `else`, and `elif` statements; nested conditionals; conditional expressions; iterators and iterables; `for` loops with `range` and nested loops; counting, sentinel, and infinite `while` loops; `break` and `continue`. |\n",
    "| [4. Functions](chapters/04-functions/0400-functions.ipynb) | Defining functions and encapsulation; parameters, default values, `*args`, and `**kwargs`; return values and type annotations; Boolean functions; local and global scope; composition, pure functions, and docstrings; lambda functions; recursion and memoization. |\n",
    "| [5. Exceptions & Testing](chapters/05-testing/0500-exception-testing.ipynb) | Types of errors and tracebacks; `try`, `except`, `else`, and `finally`; raising exceptions and custom exception classes; debugging with print statements, assertions, and bisection; logging; unit testing with `pytest`; `unittest` and doctests; mocking, parametrized tests, and coverage. |\n",
    "| [6. Sequences](chapters/06-collections/0600-collections.ipynb) | Creating and accessing lists; list comprehensions and nested lists; list operators, functions, and methods; `enumerate`, `zip`, and unpacking; aliasing and list arguments; shallow and deep copies; tuples and immutability; tuples as return values and records. |\n",
    "| [7. Dictionaries](chapters/07-dictionaries/0700-dictionaries.ipynb) | Creating dictionaries; accessing, updating, and deleting items; membership testing; dictionary comprehensions; counting with `Counter` and `defaultdict`; inverting and sorting dictionaries; hashable keys; sets, set algebra, and frozensets. |\n",
    "| [8. Strings and Text](chapters/08-strings/0800-strings.ipynb) | Escape sequences, indexing, and slicing; string methods for searching, cleaning, splitting, and formatting; comparing and sorting strings; regular expressions with the `re` module; quantifiers, anchors, character classes, and groups; cleaning text and substitution; word frequencies; Markov text generation. |\n",
    "| [9. OOP](chapters/09-oop/0900-oop.ipynb) | Classes and instances; methods, `__init__`, and properties; `__str__` and `__repr__`; encapsulation and polymorphism; inheritance and method overriding; abstract base classes; comparison methods and operator overloading; dataclasses, class methods, and static methods. |\n",
    "| [10. FP](chapters/10-functional/1000-func-prog.ipynb) | Pure functions and immutability; functions as values; higher-order functions; decorators; comprehensions and choosing a style; recursion versus iteration; context managers; `reduce`, `partial`, and `lru_cache` from `functools`. |\n",
    "| [11. Iterators & Generators](chapters/11-iter-gen/1100-iter-gen.ipynb) | The iterator protocol; built-in lazy iterators; custom iterator classes; generator functions; generator expressions; infinite sequences and `yield from`; `itertools`; async iteration. |\n",
    "| [12. APIs](chapters/12-apis/1200-apis.ipynb) | Reading an API contract; GET requests with `requests`; query parameters; error handling and safe JSON fetching; POST requests; headers and API keys; nested JSON parsing and pagination; retries with exponential backoff and response validation. |\n",
    "| [13. ADT](chapters/13-abstract-data-structures/1300-abstract-data-structures.ipynb) | Abstract types and implementations; operation tradeoffs; stacks; queues; trees; graphs and graph traversal. |\n",
    "| [14. Algorithms](chapters/14-algorithms/1400-algorithms.ipynb) | Properties of algorithms; the design process; complexity and Big O; benchmarking; linear and binary search; the `bisect` module and hash-based lookup; built-in sorting with key functions; insertion, bubble, merge, and quick sort. |\n",
    "\n",
    "Set up your environment with [Course Tooling](chapters/appendices/0101-tooling.ipynb) and [Jupyter Setup](chapters/appendices/jupyter/0200-intro-jupyter.ipynb) in the appendices before the first lab."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "323d2954",
   "metadata": {},
   "source": [
    "## How to Use This Book\n",
    "\n",
    "Each chapter section is an interactive Jupyter Notebook. You can:\n",
    "- Read through the rendered content\n",
    "- Interact with the code directly by downloading the notebooks locally or using Binder\n",
    "- Use the Live Code cells for practice"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "64a8925c-5f7b-466e-83f5-02ee5fd70e1a",
   "metadata": {},
   "source": [
    "## Live Coding \n",
    "\n",
    "Some sections include exercises that support live coding. To enable them, click the Live Code button. It may take some time to launch a new session; wait until you see a \"ready\" message. The live coding cells let you practice the concepts and skills introduced in each section.\n",
    "\n",
    "```{image} figures/thebe-loading.png\n",
    ":alt: thebe-loading\n",
    ":width: 50%\n",
    ":align: center\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5b5c02f3-911b-4127-afe5-c8e1f5724eba",
   "metadata": {},
   "source": [
    "## Credits\n",
    "\n",
    "Parts of these notes are adapted from [Think Python](https://allendowney.github.io/ThinkPython/) by Dr. Allen Downey.\n",
    "\n",
    "Videos throughout this book are embedded via YouTube's official player and remain the property of their original creators. No ownership or affiliation is claimed. Embedded videos may become unavailable if creators remove them or disable embedding. Rightsholders with concerns may contact [support@thinkpy.org](mailto:support@thinkpy.org).\n",
    "\n",
    "This work is licensed under the [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-nc-sa/4.0/)."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.13.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
