{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "4b9dd1c4",
   "metadata": {},
   "source": [
    "# 09-08 · Три структуры алгоритма и ветвление\n",
    "\n",
    "Практика к разделу [«Три структуры алгоритма и ветвление»](../../site/chapters/glava-09/09-08-tri-struktury-i-vetvlenie.html)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e03deddc",
   "metadata": {},
   "source": [
    "## Цель\n",
    "\n",
    "Отличить последовательный алгоритм от ветвящегося и построить первую развилку."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "67aefdae",
   "metadata": {},
   "source": [
    "## Рабочий пример"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "f171bc16",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T17:23:00.980547Z",
     "iopub.status.busy": "2026-08-16T17:23:00.980448Z",
     "iopub.status.idle": "2026-08-16T17:23:01.003919Z",
     "shell.execute_reply": "2026-08-16T17:23:01.001565Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "взять зонт\n"
     ]
    }
   ],
   "source": [
    "is_raining = True\n",
    "if is_raining:\n",
    "    action = \"взять зонт\"\n",
    "else:\n",
    "    action = \"без зонта\"\n",
    "print(action)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1a865a52",
   "metadata": {},
   "source": [
    "## Задание ★ Базовая практика\n",
    "\n",
    "Постройте ту же развилку для `is_raining = True` и зафиксируйте, что в программе есть ветвление (`has_branch`)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "7d0866fe",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T17:23:01.005414Z",
     "iopub.status.busy": "2026-08-16T17:23:01.005271Z",
     "iopub.status.idle": "2026-08-16T17:23:01.008724Z",
     "shell.execute_reply": "2026-08-16T17:23:01.008020Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "взять зонт True\n"
     ]
    }
   ],
   "source": [
    "is_raining = True\n",
    "if is_raining:\n",
    "    action = \"взять зонт\"\n",
    "else:\n",
    "    action = \"без зонта\"\n",
    "has_branch = True\n",
    "print(action, has_branch)"
   ]
  }
 ],
 "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
}
