{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "b0a3c490",
   "metadata": {},
   "source": [
    "# 09-20 · Вложенные условия\n",
    "\n",
    "Практика к разделу [«Вложенные условия»](../../site/chapters/glava-09/09-20-vlozhennye-uslovija.html)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "df3be7b0",
   "metadata": {},
   "source": [
    "## Цель\n",
    "\n",
    "Построить вложенное условие для проверки входа в аккаунт."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d7e17e4a",
   "metadata": {},
   "source": [
    "## Рабочий пример"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "4f78cb8a",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T17:23:10.734115Z",
     "iopub.status.busy": "2026-08-16T17:23:10.733996Z",
     "iopub.status.idle": "2026-08-16T17:23:10.749736Z",
     "shell.execute_reply": "2026-08-16T17:23:10.749258Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Добро пожаловать\n"
     ]
    }
   ],
   "source": [
    "has_account = True\n",
    "password_ok = True\n",
    "if has_account:\n",
    "    if password_ok:\n",
    "        print(\"Добро пожаловать\")\n",
    "    else:\n",
    "        print(\"Неверный пароль\")\n",
    "else:\n",
    "    print(\"Зарегистрируйтесь\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1d8ebac1",
   "metadata": {},
   "source": [
    "## Задание ★ Базовая практика\n",
    "\n",
    "Повторите с password_ok = False и убедитесь, что выбирается правильная вложенная ветка."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "ad415c98",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T17:23:10.751331Z",
     "iopub.status.busy": "2026-08-16T17:23:10.751165Z",
     "iopub.status.idle": "2026-08-16T17:23:10.754044Z",
     "shell.execute_reply": "2026-08-16T17:23:10.753568Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Неверный пароль\n"
     ]
    }
   ],
   "source": [
    "has_account = True\n",
    "password_ok = False\n",
    "if has_account:\n",
    "    if password_ok:\n",
    "        result = \"Добро пожаловать\"\n",
    "    else:\n",
    "        result = \"Неверный пароль\"\n",
    "else:\n",
    "    result = \"Зарегистрируйтесь\"\n",
    "print(result)"
   ]
  }
 ],
 "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
}
