{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "9ecd14f5",
   "metadata": {},
   "source": [
    "# 08-12 · Многострочные и raw-строки\n",
    "\n",
    "Практика к разделу [«Многострочные и raw-строки»](../../site/chapters/glava-08/08-12-mnogostrochnye-i-raw-stroki.html)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6c8ad268",
   "metadata": {},
   "source": [
    "## Цель\n",
    "\n",
    "Освоить тройные кавычки для многострочного текста и raw-строки r\"...\"."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1265ad4f",
   "metadata": {},
   "source": [
    "## Рабочий пример"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "0d917936",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T16:18:53.575189Z",
     "iopub.status.busy": "2026-08-16T16:18:53.575084Z",
     "iopub.status.idle": "2026-08-16T16:18:53.593787Z",
     "shell.execute_reply": "2026-08-16T16:18:53.593298Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Код за кодом,\n",
      "шаг за шагом —\n",
      "так рождается\n",
      "программа.\n"
     ]
    }
   ],
   "source": [
    "poem = \"\"\"Код за кодом,\n",
    "шаг за шагом —\n",
    "так рождается\n",
    "программа.\"\"\"\n",
    "print(poem)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bdba7bfc",
   "metadata": {},
   "source": [
    "## Эксперимент 1 — raw-строка против обычной"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "bae7c271",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T16:18:53.594933Z",
     "iopub.status.busy": "2026-08-16T16:18:53.594831Z",
     "iopub.status.idle": "2026-08-16T16:18:53.597240Z",
     "shell.execute_reply": "2026-08-16T16:18:53.596823Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Cartesian\n",
      "C:\\Users\\Cartesian\n",
      "True\n"
     ]
    }
   ],
   "source": [
    "bez_raw = \"C:\\\\Users\\\\Cartesian\"\n",
    "s_raw = r\"C:\\Users\\Cartesian\"\n",
    "print(bez_raw)\n",
    "print(s_raw)\n",
    "print(bez_raw == s_raw)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5c6b61a5",
   "metadata": {},
   "source": [
    "## Задание ★ Базовая практика\n",
    "\n",
    "Создайте `multiline` — строку из трёх строк текста через тройные кавычки — и `raw_path` — строку `D:\\Data\\file.txt` через raw-строку."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "2057908b",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T16:18:53.598290Z",
     "iopub.status.busy": "2026-08-16T16:18:53.598139Z",
     "iopub.status.idle": "2026-08-16T16:18:53.600775Z",
     "shell.execute_reply": "2026-08-16T16:18:53.600412Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Первая\n",
      "Вторая\n",
      "Третья\n",
      "D:\\Data\\file.txt\n"
     ]
    }
   ],
   "source": [
    "multiline = \"\"\"Первая\n",
    "Вторая\n",
    "Третья\"\"\"\n",
    "raw_path = r\"D:\\Data\\file.txt\"\n",
    "print(multiline)\n",
    "print(raw_path)"
   ]
  }
 ],
 "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
}
