{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "1c4e171d",
   "metadata": {},
   "source": [
    "# 03-04 · Wyjście danych za pomocą Python\n",
    "\n",
    "Praktyka do sekcji [„Data Output Using Python”"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5e1e0a59",
   "metadata": {},
   "source": [
    "## Cel\n",
    "\n",
    "Mistrzu `print()` szczegółowo: wiele znaczeń, `sep`, `end`."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "91581db1",
   "metadata": {},
   "source": [
    "## Co trzeba wiedzieć\n",
    "\n",
    "`print()` potrafi wyświetlać kilka wartości oddzielonych przecinkiem."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d3005581",
   "metadata": {},
   "source": [
    "## Krótkie przypomnienie\n",
    "\n",
    "- domyślnie wartości są oddzielone spacjami;\n",
    "- `sep=\"...\"` zmienia separator;\n",
    "- `end=\"...\"` zmienia znak na końcu (domyślnie — znak nowej linii)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "833b8274",
   "metadata": {},
   "source": [
    "## Sprawa robocza"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "3087d89d",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:52:12.684969Z",
     "iopub.status.busy": "2026-08-14T20:52:12.684853Z",
     "iopub.status.idle": "2026-08-14T20:52:12.701406Z",
     "shell.execute_reply": "2026-08-14T20:52:12.700969Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Возраст: 10 лет\n"
     ]
    }
   ],
   "source": [
    "print(\"Возраст:\", 10, \"лет\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fbf459fc",
   "metadata": {},
   "source": [
    "## Eksperyment 1\n",
    "\n",
    "Zmień separator na myślnik."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "ac99e57d",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:52:12.702404Z",
     "iopub.status.busy": "2026-08-14T20:52:12.702290Z",
     "iopub.status.idle": "2026-08-14T20:52:12.704461Z",
     "shell.execute_reply": "2026-08-14T20:52:12.704069Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2024-01-15\n"
     ]
    }
   ],
   "source": [
    "print(\"2024\", \"01\", \"15\", sep=\"-\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ac5bfeca",
   "metadata": {},
   "source": [
    "## Eksperyment 2\n",
    "\n",
    "Zastosowanie `end=\"\"`do dwóch wezwań `print()` były wyświetlane w jednej linii, bez łączników."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "4929f485",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:52:12.705428Z",
     "iopub.status.busy": "2026-08-14T20:52:12.705325Z",
     "iopub.status.idle": "2026-08-14T20:52:12.707617Z",
     "shell.execute_reply": "2026-08-14T20:52:12.707205Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Загрузка...готово!\n"
     ]
    }
   ],
   "source": [
    "print(\"Загрузка\", end=\"\")\n",
    "print(\"...\", end=\"\")\n",
    "print(\"готово!\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b5fff76d",
   "metadata": {},
   "source": [
    "## Zadanie ★ Podstawowa praktyka (i praktyka rozdziału: „wypisz swoje imię”)\n",
    "\n",
    "Jednym poleceniem `print()` z `sep=\" · \"` wyświetl swoje imię, miasto i ulubioną liczbę."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "354be90d",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:52:12.708690Z",
     "iopub.status.busy": "2026-08-14T20:52:12.708560Z",
     "iopub.status.idle": "2026-08-14T20:52:12.711138Z",
     "shell.execute_reply": "2026-08-14T20:52:12.710688Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Cartesian · Москва · 42\n"
     ]
    }
   ],
   "source": [
    "print(\"Cartesian\", \"Москва\", 42, sep=\" · \")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b04af67a",
   "metadata": {},
   "source": [
    "## Typowy błąd\n",
    "\n",
    "`sep` oraz `end` są nazwanymi parametrami: muszą być przekazywane po nazwie. Jeśli pomieszasz kolejność i przekazujesz je jako normalne wartości, trafią do samego wyjścia, a nie staną się separatorem."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "a29beb92",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:52:12.712147Z",
     "iopub.status.busy": "2026-08-14T20:52:12.712030Z",
     "iopub.status.idle": "2026-08-14T20:52:12.714182Z",
     "shell.execute_reply": "2026-08-14T20:52:12.713720Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "a b -\n"
     ]
    }
   ],
   "source": [
    "print(\"a\", \"b\", \"-\")  # это НЕ то же самое, что sep=\"-\""
   ]
  },
  {
   "cell_type": "markdown",
   "id": "251169c1",
   "metadata": {},
   "source": [
    "## Poprawka"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "e28daecc",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:52:12.715154Z",
     "iopub.status.busy": "2026-08-14T20:52:12.715052Z",
     "iopub.status.idle": "2026-08-14T20:52:12.717221Z",
     "shell.execute_reply": "2026-08-14T20:52:12.716822Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "a-b\n"
     ]
    }
   ],
   "source": [
    "print(\"a\", \"b\", sep=\"-\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "18a710f7",
   "metadata": {},
   "source": [
    "## Samodzielna praktyka ★★\n",
    "\n",
    "Wygeneruj tabelę składającą się z trzech linii, takich jak `имя — оценка`używania `sep=\" — \"` w każdej rozmowie."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "5e3714e2",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-14T20:52:12.718175Z",
     "iopub.status.busy": "2026-08-14T20:52:12.718073Z",
     "iopub.status.idle": "2026-08-14T20:52:12.720440Z",
     "shell.execute_reply": "2026-08-14T20:52:12.720029Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Математика — 5\n",
      "Python — 5\n",
      "Физика — 4\n"
     ]
    }
   ],
   "source": [
    "print(\"Математика\", 5, sep=\" — \")\n",
    "print(\"Python\", 5, sep=\" — \")\n",
    "print(\"Физика\", 4, sep=\" — \")"
   ]
  }
 ],
 "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
}
