{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "e6336d33",
   "metadata": {},
   "source": [
    "# 13-02 · Зачем нужны функции?\n",
    "\n",
    "Практика к разделу [«Зачем нужны функции?»](../../site/chapters/glava-13/13-02-zachem-funkcii.html)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "dac46a77",
   "metadata": {},
   "source": [
    "## Цель\n",
    "\n",
    "Освоить функции с аргументами."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "cfb90519",
   "metadata": {},
   "source": [
    "## Рабочий пример"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "56cfbff8",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-17T18:53:37.828213Z",
     "iopub.status.busy": "2026-08-17T18:53:37.828017Z",
     "iopub.status.idle": "2026-08-17T18:53:37.848767Z",
     "shell.execute_reply": "2026-08-17T18:53:37.848344Z"
    }
   },
   "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": "ab554333",
   "metadata": {},
   "source": [
    "## Эксперимент 1 — несколько параметров"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "81431f37",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-17T18:53:37.850087Z",
     "iopub.status.busy": "2026-08-17T18:53:37.849917Z",
     "iopub.status.idle": "2026-08-17T18:53:37.852363Z",
     "shell.execute_reply": "2026-08-17T18:53:37.851991Z"
    }
   },
   "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": "574089fd",
   "metadata": {},
   "source": [
    "## Задание ★ Базовая практика\n",
    "\n",
    "Напишите функцию `plosch_pryamougolnika(width, height)`, которая выводит площадь."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "12bb677b",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-17T18:53:37.853357Z",
     "iopub.status.busy": "2026-08-17T18:53:37.853254Z",
     "iopub.status.idle": "2026-08-17T18:53:37.855733Z",
     "shell.execute_reply": "2026-08-17T18:53:37.855243Z"
    }
   },
   "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
}
