{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "0a8eccd5",
   "metadata": {},
   "source": [
    "# 08-21 · Приветствие и форматирование ФИО\n",
    "\n",
    "Практика к разделу [«Мини-проект: приветствие и ФИО»](../../site/chapters/glava-08/08-21-mini-proekt-privetstvie-i-imya.html)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ddaa7980",
   "metadata": {},
   "source": [
    "## Цель\n",
    "\n",
    "Собрать strip(), capitalize() и f-строки в форматировщике ФИО."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6a4b7d7b",
   "metadata": {},
   "source": [
    "## Про input() в этом ноутбуке\n",
    "\n",
    "В обычном `.py`-файле `input()` ждёт, пока вы наберёте текст и нажмёте Enter. Этот ноутбук выполняется автоматически, без живого человека за клавиатурой — поэтому здесь `input()` временно подменён на заранее заготовленные ответы. Сам код с `input()` ниже выглядит и работает точно так же, как в обычном файле, который вы запускаете сами."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "9e3119aa",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T16:18:59.310042Z",
     "iopub.status.busy": "2026-08-16T16:18:59.309892Z",
     "iopub.status.idle": "2026-08-16T16:18:59.325759Z",
     "shell.execute_reply": "2026-08-16T16:18:59.325147Z"
    }
   },
   "outputs": [],
   "source": [
    "_answers = iter(['  ада  ', 'ЛАВЛЕЙС'])\n",
    "\n",
    "def input(prompt=\"\"):\n",
    "    answer = next(_answers)\n",
    "    print(prompt + answer)\n",
    "    return answer"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3ee74fa9",
   "metadata": {},
   "source": [
    "## Задание ★ Базовая практика\n",
    "\n",
    "Спросите имя и фамилию через input(), приведите каждое к аккуратному виду (strip + capitalize) и соберите `full_name` и `initials`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "0db299b8",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T16:18:59.327224Z",
     "iopub.status.busy": "2026-08-16T16:18:59.327095Z",
     "iopub.status.idle": "2026-08-16T16:18:59.330119Z",
     "shell.execute_reply": "2026-08-16T16:18:59.329589Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Имя:   ада  \n",
      "Фамилия: ЛАВЛЕЙС\n",
      "Ада Лавлейс\n",
      "А. Л.\n"
     ]
    }
   ],
   "source": [
    "raw_first = input(\"Имя: \")\n",
    "raw_last = input(\"Фамилия: \")\n",
    "\n",
    "first = raw_first.strip().capitalize()\n",
    "last = raw_last.strip().capitalize()\n",
    "full_name = f\"{first} {last}\"\n",
    "initials = f\"{first[0]}. {last[0]}.\"\n",
    "\n",
    "print(full_name)\n",
    "print(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
}
