{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "ea12389a",
   "metadata": {},
   "source": [
    "# 13-02 · Зачем нужны функции?\n",
    "\n",
    "Практика к разделу [«Зачем нужны функции?»](../../site/chapters/glava-13/13-02-zachem-funkcii.html)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8d82413f",
   "metadata": {},
   "source": [
    "## Цель\n",
    "\n",
    "Освоить функции с аргументами."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "919640b6",
   "metadata": {},
   "source": [
    "## Рабочий пример"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "ac495c11",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:58:36.090019Z",
     "iopub.status.busy": "2026-08-14T20:58:36.089918Z",
     "iopub.status.idle": "2026-08-14T20:58:36.110259Z",
     "shell.execute_reply": "2026-08-14T20:58:36.109229Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Привет, Ада!\n",
      "Привет, Cartesian!\n"
     ]
    }
   ],
   "source": [
    "def privetstvie(imya):\n",
    "    print(f\"Привет, {imya}!\")\n",
    "\n",
    "privetstvie(\"Ада\")\n",
    "privetstvie(\"Cartesian\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "61e90221",
   "metadata": {},
   "source": [
    "## Эксперимент 1 — несколько параметров"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "4d405a6c",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:58:36.111768Z",
     "iopub.status.busy": "2026-08-14T20:58:36.111577Z",
     "iopub.status.idle": "2026-08-14T20:58:36.114208Z",
     "shell.execute_reply": "2026-08-14T20:58:36.113707Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Сумма: 7, произведение: 12\n",
      "Сумма: 12, произведение: 20\n"
     ]
    }
   ],
   "source": [
    "def summa_i_proizvedenie(a, b):\n",
    "    print(f\"Сумма: {a + b}, произведение: {a * b}\")\n",
    "\n",
    "summa_i_proizvedenie(3, 4)\n",
    "summa_i_proizvedenie(10, 2)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ddf5c624",
   "metadata": {},
   "source": [
    "## Задание ★ Базовая практика\n",
    "\n",
    "Напишите функцию `plosch_pryamougolnika(width, height)`, которая выводит площадь."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "3efb4f8c",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:58:36.115149Z",
     "iopub.status.busy": "2026-08-14T20:58:36.115030Z",
     "iopub.status.idle": "2026-08-14T20:58:36.117523Z",
     "shell.execute_reply": "2026-08-14T20:58:36.117109Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Площадь: 15\n",
      "Площадь: 100\n"
     ]
    }
   ],
   "source": [
    "def plosch_pryamougolnika(width, height):\n",
    "    print(f\"Площадь: {width * height}\")\n",
    "\n",
    "plosch_pryamougolnika(5, 3)\n",
    "plosch_pryamougolnika(10, 10)"
   ]
  }
 ],
 "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
}
