{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "3b74d462",
   "metadata": {},
   "source": [
    "# 11-10 · Мини-проект — перестановка имени\n",
    "\n",
    "Практика к разделу [«Мини-проект — перестановка имени и фамилии»](../../site/chapters/glava-11/11-10-mini-proekt-perestanovka-itogi.html)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b958889d",
   "metadata": {},
   "source": [
    "## Цель\n",
    "\n",
    "split() + распаковка списка."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c580bc60",
   "metadata": {},
   "source": [
    "## Про input() в этом ноутбуке\n",
    "\n",
    "Этот ноутбук выполняется автоматически, поэтому `input()` временно подменён на заранее заготовленные ответы."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "e958ef6c",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-17T14:44:30.593517Z",
     "iopub.status.busy": "2026-08-17T14:44:30.593366Z",
     "iopub.status.idle": "2026-08-17T14:44:30.618749Z",
     "shell.execute_reply": "2026-08-17T14:44:30.618297Z"
    }
   },
   "outputs": [],
   "source": [
    "_answers = iter(['Ада Лавлейс'])\n",
    "\n",
    "def input(prompt=\"\"):\n",
    "    answer = next(_answers)\n",
    "    print(prompt + answer)\n",
    "    return answer"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "333e7652",
   "metadata": {},
   "source": [
    "## Рабочий пример"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "dba10d80",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-17T14:44:30.619945Z",
     "iopub.status.busy": "2026-08-17T14:44:30.619837Z",
     "iopub.status.idle": "2026-08-17T14:44:30.622208Z",
     "shell.execute_reply": "2026-08-17T14:44:30.621776Z"
    }
   },
   "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": "7842a3f6",
   "metadata": {},
   "source": [
    "## Задание ★★ Самостоятельная задача — три части имени"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8115f16c",
   "metadata": {},
   "source": [
    "## Про input() в этом ноутбуке\n",
    "\n",
    "Этот ноутбук выполняется автоматически, поэтому `input()` временно подменён на заранее заготовленные ответы."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "ca3b60ca",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-17T14:44:30.623238Z",
     "iopub.status.busy": "2026-08-17T14:44:30.623132Z",
     "iopub.status.idle": "2026-08-17T14:44:30.625257Z",
     "shell.execute_reply": "2026-08-17T14:44:30.624902Z"
    }
   },
   "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": "8fab51e9",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-17T14:44:30.626360Z",
     "iopub.status.busy": "2026-08-17T14:44:30.626243Z",
     "iopub.status.idle": "2026-08-17T14:44:30.628609Z",
     "shell.execute_reply": "2026-08-17T14:44:30.628179Z"
    }
   },
   "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
}
