{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "9e6326be",
   "metadata": {},
   "source": [
    "# 10-10 · enumerate() и накопление\n",
    "\n",
    "Практика к разделу [«Индекс, значение и enumerate()»](../../site/chapters/glava-10/10-10-enumerate-i-nakoplenie.html)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8c91653a",
   "metadata": {},
   "source": [
    "## Цель\n",
    "\n",
    "Освоить enumerate() и паттерны счётчика/накопителя."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "aea16915",
   "metadata": {},
   "source": [
    "## Рабочий пример"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "6e28ca3e",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T20:12:48.486888Z",
     "iopub.status.busy": "2026-08-16T20:12:48.486703Z",
     "iopub.status.idle": "2026-08-16T20:12:48.517751Z",
     "shell.execute_reply": "2026-08-16T20:12:48.517284Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0 P\n",
      "1 y\n",
      "2 t\n",
      "3 h\n",
      "4 o\n",
      "5 n\n"
     ]
    }
   ],
   "source": [
    "slovo = \"Python\"\n",
    "for i, letter in enumerate(slovo):\n",
    "    print(i, letter)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "40b82d66",
   "metadata": {},
   "source": [
    "## Задание ★ Базовая практика\n",
    "\n",
    "Используя enumerate(), соберите список строк вида `\"1: хлеб\"` (нумерация с 1, а не с 0) в переменную `spisok_s_nomerami`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "a8b6170b",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T20:12:48.519611Z",
     "iopub.status.busy": "2026-08-16T20:12:48.519409Z",
     "iopub.status.idle": "2026-08-16T20:12:48.523116Z",
     "shell.execute_reply": "2026-08-16T20:12:48.522276Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['1: хлеб', '2: молоко', '3: яйца', '4: сыр']\n"
     ]
    }
   ],
   "source": [
    "produkty = [\"хлеб\", \"молоко\", \"яйца\", \"сыр\"]\n",
    "spisok_s_nomerami = []\n",
    "for i, p in enumerate(produkty):\n",
    "    spisok_s_nomerami.append(f\"{i + 1}: {p}\")\n",
    "print(spisok_s_nomerami)"
   ]
  }
 ],
 "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
}
