{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "ac8ef48f",
   "metadata": {},
   "source": [
    "# 11-02 · Срезы списков\n",
    "\n",
    "Практика к разделу [«Делаем срез списка!»](../../site/chapters/glava-11/11-02-srezy-spiskov.html)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7f168161",
   "metadata": {},
   "source": [
    "## Цель\n",
    "\n",
    "Освоить срезы списков."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "11474c3f",
   "metadata": {},
   "source": [
    "## Рабочий пример"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "b23bc35d",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:55:38.125921Z",
     "iopub.status.busy": "2026-08-14T20:55:38.125811Z",
     "iopub.status.idle": "2026-08-14T20:55:38.141617Z",
     "shell.execute_reply": "2026-08-14T20:55:38.141115Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[20, 30]\n",
      "[10, 20]\n",
      "[30, 40, 50]\n",
      "[50, 40, 30, 20, 10]\n"
     ]
    }
   ],
   "source": [
    "chisla = [10, 20, 30, 40, 50]\n",
    "print(chisla[1:3])\n",
    "print(chisla[:2])\n",
    "print(chisla[2:])\n",
    "print(chisla[::-1])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1a5e361a",
   "metadata": {},
   "source": [
    "## Задание ★ Базовая практика\n",
    "\n",
    "Достаньте средние три числа из списка `[1, 2, 3, 4, 5, 6, 7]`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "98106bd7",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:55:38.142836Z",
     "iopub.status.busy": "2026-08-14T20:55:38.142703Z",
     "iopub.status.idle": "2026-08-14T20:55:38.145253Z",
     "shell.execute_reply": "2026-08-14T20:55:38.144830Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[3, 4, 5]\n"
     ]
    }
   ],
   "source": [
    "numbers = [1, 2, 3, 4, 5, 6, 7]\n",
    "print(numbers[2:5])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6dd057e3",
   "metadata": {},
   "source": [
    "## Проверка результата"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "57929c47",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:55:38.146446Z",
     "iopub.status.busy": "2026-08-14T20:55:38.146330Z",
     "iopub.status.idle": "2026-08-14T20:55:38.148701Z",
     "shell.execute_reply": "2026-08-14T20:55:38.148241Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Верно.\n"
     ]
    }
   ],
   "source": [
    "assert [1,2,3,4,5,6,7][2:5] == [3, 4, 5]\n",
    "print(\"Верно.\")"
   ]
  }
 ],
 "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
}
