{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "0780b264",
   "metadata": {},
   "source": [
    "# 13-18 · Контракт функции\n",
    "\n",
    "Практика к разделу [«Проектируем хорошую функцию»](../../site/chapters/glava-13/13-18-proektiruem-funkciyu.html)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a9106e70",
   "metadata": {},
   "source": [
    "## Цель\n",
    "\n",
    "Реализовать функцию по заданному контракту."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "611efdaa",
   "metadata": {},
   "source": [
    "## Задание ★ Базовая практика\n",
    "\n",
    "Контракт: calculate_discount(price, percent) — цена со скидкой в процентах."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "34a93cba",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-17T18:54:07.080638Z",
     "iopub.status.busy": "2026-08-17T18:54:07.080540Z",
     "iopub.status.idle": "2026-08-17T18:54:07.100712Z",
     "shell.execute_reply": "2026-08-17T18:54:07.100245Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "90.0 100.0\n"
     ]
    }
   ],
   "source": [
    "def calculate_discount(price, percent):\n",
    "    return price - price * percent / 100\n",
    "\n",
    "d1 = calculate_discount(100, 10)\n",
    "d2 = calculate_discount(200, 50)\n",
    "print(d1, d2)"
   ]
  }
 ],
 "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
}
