{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "6f90ce07",
   "metadata": {},
   "source": [
    "# 04-06 · Большие числа и неизменяемость int\n",
    "\n",
    "Практика к разделу [«int — целые числа без страха»](../../site/chapters/glava-04/04-06-int-glubzhe.html)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "26878d8b",
   "metadata": {},
   "source": [
    "## Цель\n",
    "\n",
    "Увидеть произвольную точность int и проверить неизменяемость на практике."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0e400a6f",
   "metadata": {},
   "source": [
    "## Рабочий пример"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "762412dc",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T10:03:16.956299Z",
     "iopub.status.busy": "2026-08-16T10:03:16.956178Z",
     "iopub.status.idle": "2026-08-16T10:03:16.977601Z",
     "shell.execute_reply": "2026-08-16T10:03:16.977096Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "100000000000000000000000000000000000000000000000000\n"
     ]
    }
   ],
   "source": [
    "huge = 10 ** 50\n",
    "print(huge)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "011687a2",
   "metadata": {},
   "source": [
    "## Эксперимент 1\n",
    "\n",
    "Предскажите: сколько цифр будет в результате `10 ** 100`? Проверьте через `len(str(...))`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "30d7ffcd",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T10:03:16.978591Z",
     "iopub.status.busy": "2026-08-16T10:03:16.978483Z",
     "iopub.status.idle": "2026-08-16T10:03:16.980782Z",
     "shell.execute_reply": "2026-08-16T10:03:16.980244Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "101\n"
     ]
    }
   ],
   "source": [
    "big = 10 ** 100\n",
    "print(len(str(big)))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "83a3fc5c",
   "metadata": {},
   "source": [
    "## Эксперимент 2\n",
    "\n",
    "Проверьте неизменяемость: создайте `a`, скопируйте в `b`, измените `a` — `b` не должен измениться."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "c28bb633",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T10:03:16.981944Z",
     "iopub.status.busy": "2026-08-16T10:03:16.981781Z",
     "iopub.status.idle": "2026-08-16T10:03:16.984621Z",
     "shell.execute_reply": "2026-08-16T10:03:16.984051Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "15\n",
      "10\n"
     ]
    }
   ],
   "source": [
    "a = 10\n",
    "b = a\n",
    "a += 5\n",
    "print(a)\n",
    "print(b)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f4b48c38",
   "metadata": {},
   "source": [
    "## Задание ★ Базовая практика\n",
    "\n",
    "Запишите население страны с разделителями-подчёркиваниями (например, 38_000_000) в переменную `population` и выведите её."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "badd992c",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T10:03:16.985785Z",
     "iopub.status.busy": "2026-08-16T10:03:16.985630Z",
     "iopub.status.idle": "2026-08-16T10:03:16.988116Z",
     "shell.execute_reply": "2026-08-16T10:03:16.987607Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "38000000\n"
     ]
    }
   ],
   "source": [
    "population = 38_000_000\n",
    "print(population)"
   ]
  }
 ],
 "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
}
