{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "e61e63b3",
   "metadata": {},
   "source": [
    "#03-05 · Przewiduj i testuj: REPL\n",
    "\n",
    "Praktyka do sekcji [„REPL jako narzędzie badawcze”"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4dedbbb1",
   "metadata": {},
   "source": [
    "## Cel\n",
    "\n",
    "Ćwicz przewidywanie, co pokaże REPL/komórka, zanim uruchomisz kod — i sprawdź się za pomocą `type()`."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0486c5f8",
   "metadata": {},
   "source": [
    "## Co trzeba wiedzieć\n",
    "\n",
    "`type(значение)` pokazuje rodzaj wartości: `<class 'int'>`, `<class 'str'>` i tak dalej."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "dec1027d",
   "metadata": {},
   "source": [
    "## Krótkie przypomnienie\n",
    "\n",
    "Komórka (tak jak REPL) sama drukuje wynik *ostatniego* wyrażenia — ale nie wynik `print()`nazywa ten druk samodzielnie, niezależnie od tego, czy jest najnowszy, czy nie."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "afe78109",
   "metadata": {},
   "source": [
    "## Sprawa robocza"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "04ee9aa9",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T01:25:09.540685Z",
     "iopub.status.busy": "2026-08-16T01:25:09.540584Z",
     "iopub.status.idle": "2026-08-16T01:25:09.562581Z",
     "shell.execute_reply": "2026-08-16T01:25:09.562123Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "int"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(42)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0a0a28e3",
   "metadata": {},
   "source": [
    "## Eksperyment 1\n",
    "\n",
    "Zanim wystartujesz – przewiduj: jaki rodzaj `\"42\"` (w cudzysłowie)? To odhaczone."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "5664ad06",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T01:25:09.563622Z",
     "iopub.status.busy": "2026-08-16T01:25:09.563505Z",
     "iopub.status.idle": "2026-08-16T01:25:09.565896Z",
     "shell.execute_reply": "2026-08-16T01:25:09.565479Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "str"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(\"42\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "023f9a3d",
   "metadata": {},
   "source": [
    "## Eksperyment 2\n",
    "\n",
    "Przewidywać rodzaj wyniku `10 / 2` będzie `int` lub `float`? To sprawdź."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "2f5adfed",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T01:25:09.566743Z",
     "iopub.status.busy": "2026-08-16T01:25:09.566637Z",
     "iopub.status.idle": "2026-08-16T01:25:09.569105Z",
     "shell.execute_reply": "2026-08-16T01:25:09.568694Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "float"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(10 / 2)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e7a605b7",
   "metadata": {},
   "source": [
    "## Typowy błąd\n",
    "\n",
    "Początkujący czasem tego oczekują `dir(42)` na pierwszy rzut oka pokaże coś zrozumiałego — w rzeczywistości to długa lista nazw usług. To w porządku: na razie musisz umieć URUCHOMIĆ `dir()`zamiast rozumieć każde nazwisko na liście."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "1fde84b9",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T01:25:09.570022Z",
     "iopub.status.busy": "2026-08-16T01:25:09.569920Z",
     "iopub.status.idle": "2026-08-16T01:25:09.572261Z",
     "shell.execute_reply": "2026-08-16T01:25:09.571916Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(dir(42)) > 0  # просто убеждаемся, что список не пустой"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "73f67cf6",
   "metadata": {},
   "source": [
    "## Podstawowa praktyka zadań ★\n",
    "\n",
    "Wypisz typ każdej z trzech wartości: `3.14`, `True`, `[1, 2, 3]` — trzy oddzielne wezwania `print(type(...))`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "7828a1ac",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T01:25:09.573318Z",
     "iopub.status.busy": "2026-08-16T01:25:09.573215Z",
     "iopub.status.idle": "2026-08-16T01:25:09.575446Z",
     "shell.execute_reply": "2026-08-16T01:25:09.575028Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'float'>\n",
      "<class 'bool'>\n",
      "<class 'list'>\n"
     ]
    }
   ],
   "source": [
    "print(type(3.14))\n",
    "print(type(True))\n",
    "print(type([1, 2, 3]))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e4d3fa60",
   "metadata": {},
   "source": [
    "## Samodzielna praktyka ★★\n",
    "\n",
    "Zastosowanie `help(print)`przeczytać wbudowaną pomoc `print`i wypisz w tekście to, czego się tam nauczyłeś (na przykład nazwy parametrów)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "97a50218",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T01:25:09.576281Z",
     "iopub.status.busy": "2026-08-16T01:25:09.576173Z",
     "iopub.status.idle": "2026-08-16T01:25:09.578724Z",
     "shell.execute_reply": "2026-08-16T01:25:09.578251Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on built-in function print in module builtins:\n",
      "\n",
      "print(*args, sep=' ', end='\\n', file=None, flush=False)\n",
      "    Prints the values to a stream, or to sys.stdout by default.\n",
      "\n",
      "    sep\n",
      "      string inserted between values, default a space.\n",
      "    end\n",
      "      string appended after the last value, default a newline.\n",
      "    file\n",
      "      a file-like object (stream); defaults to the current sys.stdout.\n",
      "    flush\n",
      "      whether to forcibly flush the stream.\n",
      "\n",
      "Узнал(а): print принимает sep и end\n"
     ]
    }
   ],
   "source": [
    "help(print)\n",
    "print(\"Узнал(а): print принимает sep и end\")"
   ]
  }
 ],
 "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
}
