{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "4cde71d4",
   "metadata": {},
   "source": [
    "# 11-10 · Мини-проект — перестановка имени\n",
    "\n",
    "Практика к разделу [«Мини-проект — перестановка имени и фамилии»](../../site/chapters/glava-11/11-10-mini-proekt-perestanovka-itogi.html)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8ecaf63d",
   "metadata": {},
   "source": [
    "## Цель\n",
    "\n",
    "split() + распаковка списка."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bbc6c10a",
   "metadata": {},
   "source": [
    "## Про input() в этом ноутбуке\n",
    "\n",
    "Этот ноутбук выполняется автоматически, поэтому `input()` временно подменён на заранее заготовленные ответы."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "0febb000",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:55:54.122823Z",
     "iopub.status.busy": "2026-08-14T20:55:54.122717Z",
     "iopub.status.idle": "2026-08-14T20:55:54.145310Z",
     "shell.execute_reply": "2026-08-14T20:55:54.144812Z"
    }
   },
   "outputs": [],
   "source": [
    "_answers = iter(['Ада Лавлейс'])\n",
    "\n",
    "def input(prompt=\"\"):\n",
    "    answer = next(_answers)\n",
    "    print(prompt + answer)\n",
    "    return answer"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "95ee6636",
   "metadata": {},
   "source": [
    "## Рабочий пример"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "613b4144",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:55:54.146487Z",
     "iopub.status.busy": "2026-08-14T20:55:54.146369Z",
     "iopub.status.idle": "2026-08-14T20:55:54.148817Z",
     "shell.execute_reply": "2026-08-14T20:55:54.148337Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Введите имя и фамилию через пробел: Ада Лавлейс\n",
      "Лавлейс Ада\n"
     ]
    }
   ],
   "source": [
    "full_name = input(\"Введите имя и фамилию через пробел: \")\n",
    "parts = full_name.split()\n",
    "name, surname = parts\n",
    "\n",
    "print(f\"{surname} {name}\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fc0a7f71",
   "metadata": {},
   "source": [
    "## Задание ★★ Самостоятельная задача — три части имени"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b37691e0",
   "metadata": {},
   "source": [
    "## Про input() в этом ноутбуке\n",
    "\n",
    "Этот ноутбук выполняется автоматически, поэтому `input()` временно подменён на заранее заготовленные ответы."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "1925f3c6",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:55:54.149728Z",
     "iopub.status.busy": "2026-08-14T20:55:54.149626Z",
     "iopub.status.idle": "2026-08-14T20:55:54.151782Z",
     "shell.execute_reply": "2026-08-14T20:55:54.151396Z"
    }
   },
   "outputs": [],
   "source": [
    "_answers = iter(['Ада Августовна Лавлейс'])\n",
    "\n",
    "def input(prompt=\"\"):\n",
    "    answer = next(_answers)\n",
    "    print(prompt + answer)\n",
    "    return answer"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "c6751a2d",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:55:54.152844Z",
     "iopub.status.busy": "2026-08-14T20:55:54.152735Z",
     "iopub.status.idle": "2026-08-14T20:55:54.155053Z",
     "shell.execute_reply": "2026-08-14T20:55:54.154682Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Введите имя, отчество и фамилию через пробел: Ада Августовна Лавлейс\n",
      "Лавлейс А.А.\n"
     ]
    }
   ],
   "source": [
    "full_name = input(\"Введите имя, отчество и фамилию через пробел: \")\n",
    "name, patronymic, surname = full_name.split()\n",
    "initials = f\"{name[0]}.{patronymic[0]}.\"\n",
    "print(f\"{surname} {initials}\")"
   ]
  }
 ],
 "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
}
