{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "cc8b24d8",
   "metadata": {},
   "source": [
    "# 04-02 · Единицы измерения и комментарии\n",
    "\n",
    "Практика к разделу [«Комментарии в вычислениях»](../../site/chapters/glava-04/04-02-kommentarii.html)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3496f86d",
   "metadata": {},
   "source": [
    "## Цель\n",
    "\n",
    "Сделать числовой код понятным через осмысленные имена и комментарии к формулам."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "018ae014",
   "metadata": {},
   "source": [
    "## Рабочий пример"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "b9773444",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T10:03:15.053911Z",
     "iopub.status.busy": "2026-08-16T10:03:15.053809Z",
     "iopub.status.idle": "2026-08-16T10:03:15.069376Z",
     "shell.execute_reply": "2026-08-16T10:03:15.069020Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "120\n"
     ]
    }
   ],
   "source": [
    "distance = 120  # км\n",
    "print(distance)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5c2fb0e7",
   "metadata": {},
   "source": [
    "## Задание ★ Базовая практика\n",
    "\n",
    "Перепишите переменную `distance` в `distance_km`, добавьте переменную `price` для стоимости и переименуйте её в `price_usd`. Выведите обе."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "1dbe52df",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T10:03:15.070641Z",
     "iopub.status.busy": "2026-08-16T10:03:15.070532Z",
     "iopub.status.idle": "2026-08-16T10:03:15.072729Z",
     "shell.execute_reply": "2026-08-16T10:03:15.072329Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "120\n",
      "49\n"
     ]
    }
   ],
   "source": [
    "distance_km = 120\n",
    "price_usd = 49\n",
    "print(distance_km)\n",
    "print(price_usd)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2a14592d",
   "metadata": {},
   "source": [
    "## Самостоятельная практика ★★\n",
    "\n",
    "Напишите строку с НДС (как в уроке), добавив комментарий, объясняющий ставку, и посчитайте итог."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "d68a39df",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T10:03:15.073601Z",
     "iopub.status.busy": "2026-08-16T10:03:15.073501Z",
     "iopub.status.idle": "2026-08-16T10:03:15.075714Z",
     "shell.execute_reply": "2026-08-16T10:03:15.075261Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "123.0\n"
     ]
    }
   ],
   "source": [
    "# НДС в учебном примере: 23 %\n",
    "vat_rate = 0.23\n",
    "price = 100\n",
    "total = price * (1 + vat_rate)\n",
    "print(total)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Cartesian Python 3.14",
   "language": "python",
   "name": "cartesian-python314"
  },
  "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.14.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
