{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "bd0fc894",
   "metadata": {},
   "source": [
    "# 14-01 · Что такое ООП?\n",
    "\n",
    "Практика к разделу [«Что такое объектно-ориентированное программирование?»](../../site/chapters/glava-14/14-01-chto-takoe-oop.html)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "66a421cb",
   "metadata": {},
   "source": [
    "## Цель\n",
    "\n",
    "Узнать объекты в уже знакомом коде."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6c1b8672",
   "metadata": {},
   "source": [
    "## Рабочий пример"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "337f8886",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:58:46.690262Z",
     "iopub.status.busy": "2026-08-14T20:58:46.690118Z",
     "iopub.status.idle": "2026-08-14T20:58:46.713478Z",
     "shell.execute_reply": "2026-08-14T20:58:46.712984Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'str'>\n",
      "PYTHON\n"
     ]
    }
   ],
   "source": [
    "text = \"Python\"\n",
    "print(type(text))          # str — это класс\n",
    "print(text.upper())        # upper() — метод этого объекта"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "94dda103",
   "metadata": {},
   "source": [
    "## Эксперимент 1\n",
    "\n",
    "Проверьте класс нескольких уже знакомых объектов."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "d388d79b",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:58:46.714571Z",
     "iopub.status.busy": "2026-08-14T20:58:46.714452Z",
     "iopub.status.idle": "2026-08-14T20:58:46.717052Z",
     "shell.execute_reply": "2026-08-14T20:58:46.716559Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "42 -> <class 'int'>\n",
      "3.14 -> <class 'float'>\n",
      "текст -> <class 'str'>\n",
      "[1, 2, 3] -> <class 'list'>\n",
      "{'a': 1} -> <class 'dict'>\n"
     ]
    }
   ],
   "source": [
    "for value in [42, 3.14, \"текст\", [1, 2, 3], {\"a\": 1}]:\n",
    "    print(value, \"->\", type(value))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1080101b",
   "metadata": {},
   "source": [
    "## Задание ★ Базовая практика\n",
    "\n",
    "Найдите три метода у списка (глава 11) и объясните своими словами, что каждый из них делает."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "e9de45cd",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:58:46.718101Z",
     "iopub.status.busy": "2026-08-14T20:58:46.717874Z",
     "iopub.status.idle": "2026-08-14T20:58:46.720444Z",
     "shell.execute_reply": "2026-08-14T20:58:46.720027Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[4, 3, 2, 1]\n"
     ]
    }
   ],
   "source": [
    "numbers = [3, 1, 2]\n",
    "numbers.append(4)   # добавляет элемент\n",
    "numbers.sort()       # сортирует список\n",
    "numbers.reverse()    # разворачивает список\n",
    "print(numbers)"
   ]
  }
 ],
 "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
}
