{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "9fef6dfe",
   "metadata": {},
   "source": [
    "# 01-01 · Witamy w Python\n",
    "\n",
    "Praktyka do rozdziału 1 książki «Python od zera» (Cartesian School). Żadnej instalacji nie trzeba —\n",
    "to Twój pierwszy kontakt z działającym kodem."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "70c8f3ce",
   "metadata": {},
   "source": [
    "## Cel\n",
    "\n",
    "Poczuj, jak to jest uruchomić kod i od razu zobaczyć efekt. Brak teorii, po prostu\n",
    "pierwsze doświadczenie."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "465f7165",
   "metadata": {},
   "source": [
    "## Co trzeba wiedzieć\n",
    "\n",
    "Nic. Naprawdę. Jeśli nigdy wcześniej nie prowadziłeś kodu, to świetne miejsce, by zacząć."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ce508429",
   "metadata": {},
   "source": [
    "## Krótkie przypomnienie\n",
    "\n",
    "Komenda `print(...)` pokazuje, co jej przekazałeś. Zawsze pisz w Python\n",
    "polega na cudzysłowie — pojedynczym `'...'` lub podwójnie `\"...\"`nie ma różnicy."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1ce28a4a",
   "metadata": {},
   "source": [
    "## Sprawa robocza"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "123af533",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-15T22:28:54.385393Z",
     "iopub.status.busy": "2026-08-15T22:28:54.385284Z",
     "iopub.status.idle": "2026-08-15T22:28:54.401603Z",
     "shell.execute_reply": "2026-08-15T22:28:54.401091Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Привет, мир!\n"
     ]
    }
   ],
   "source": [
    "print(\"Привет, мир!\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "28a08e34",
   "metadata": {},
   "source": [
    "## Eksperyment 1\n",
    "\n",
    "Zamień tekst w cudzysłowie na własne pozdrowienia i ponownie przejdź komórkę."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "0e456edb",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-15T22:28:54.402621Z",
     "iopub.status.busy": "2026-08-15T22:28:54.402510Z",
     "iopub.status.idle": "2026-08-15T22:28:54.404934Z",
     "shell.execute_reply": "2026-08-15T22:28:54.404487Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Привет, Cartesian School!\n"
     ]
    }
   ],
   "source": [
    "print(\"Привет, Cartesian School!\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4e026e2e",
   "metadata": {},
   "source": [
    "## Eksperyment 2\n",
    "\n",
    "`print()` może wyświetlać nie tylko tekst. Spróbuj podać mu liczbę lub przykład\n",
    "arytmetyce Python sam wszystko obliczy."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "13212c5b",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-15T22:28:54.405887Z",
     "iopub.status.busy": "2026-08-15T22:28:54.405774Z",
     "iopub.status.idle": "2026-08-15T22:28:54.407748Z",
     "shell.execute_reply": "2026-08-15T22:28:54.407389Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "33\n",
      "42\n"
     ]
    }
   ],
   "source": [
    "print(2024 - 1991)\n",
    "print(7 * 6)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2dc453ce",
   "metadata": {},
   "source": [
    "## Typowy błąd\n",
    "\n",
    "Jeśli usuniesz cudzysłów, Python pomyśli, że mówisz o czymś po imieniu, a nie o zwykłym\n",
    "tekstu. **Nazwa** — to zakodowana etykieta, po której Python szuka wcześniej z nią powiązanego\n",
    "wartość lub funkcję. Nazwy i zmienne są szczegółowo omówione w poniższych teoretycznych materiałach\n",
    "sekcję. Wystarczy znać: nazwę `Привет` jeszcze nie określono, więc Python zgłosi\n",
    "błąd `NameError`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "7c689dc3",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-15T22:28:54.408816Z",
     "iopub.status.busy": "2026-08-15T22:28:54.408713Z",
     "iopub.status.idle": "2026-08-15T22:28:54.440485Z",
     "shell.execute_reply": "2026-08-15T22:28:54.440111Z"
    },
    "tags": [
     "raises-exception"
    ]
   },
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'Привет' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[31m---------------------------------------------------------------------------\u001b[39m",
      "\u001b[31mNameError\u001b[39m                                 Traceback (most recent call last)",
      "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[4]\u001b[39m\u001b[32m, line 2\u001b[39m\n\u001b[32m      1\u001b[39m \u001b[38;5;66;03m# ошибка: текст без кавычек\u001b[39;00m\n\u001b[32m----> \u001b[39m\u001b[32m2\u001b[39m print(Привет)\n",
      "\u001b[31mNameError\u001b[39m: name 'Привет' is not defined"
     ]
    }
   ],
   "source": [
    "# błąd: tekst bez cudzysłowu\n",
    "print(Привет)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "affe41e9",
   "metadata": {},
   "source": [
    "## Poprawka\n",
    "\n",
    "Wystarczy zwrócić cudzysłów – wtedy Python rozumie, że to zwykły tekst, a nie nazwa\n",
    "zmiennej."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "624e386d",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-15T22:28:54.441778Z",
     "iopub.status.busy": "2026-08-15T22:28:54.441657Z",
     "iopub.status.idle": "2026-08-15T22:28:54.443801Z",
     "shell.execute_reply": "2026-08-15T22:28:54.443413Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Привет\n"
     ]
    }
   ],
   "source": [
    "print(\"Привет\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4f0296e6",
   "metadata": {},
   "source": [
    "## Podstawowa praktyka zadań ★\n",
    "\n",
    "Na ekranie wyświetl trzy linie: swoje imię, ulubiony kolor i liczbę, którą lubisz.\n",
    "Każdy łańcuch znaków to osobne wyzwanie `print()`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "3ca309a1",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-15T22:28:54.444818Z",
     "iopub.status.busy": "2026-08-15T22:28:54.444648Z",
     "iopub.status.idle": "2026-08-15T22:28:54.447049Z",
     "shell.execute_reply": "2026-08-15T22:28:54.446616Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Cartesian School\n",
      "Электрик-синий\n",
      "14\n"
     ]
    }
   ],
   "source": [
    "print(\"Cartesian School\")\n",
    "print(\"Электрик-синий\")\n",
    "print(14)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ec2841a6",
   "metadata": {},
   "source": [
    "## Praktyka samodzielne\n",
    "\n",
    "`print()` można przywołać dowolną liczbę razy z rzędu, co oznacza, że można używać symboli na ekranie\n",
    "złożyć prosty obraz. Spróbuj narysować coś własnego tekstem: dom, choinkę,\n",
    "emoji to wszystko od znaków klawiaturowych."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "e1a23aa4",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-15T22:28:54.447934Z",
     "iopub.status.busy": "2026-08-15T22:28:54.447833Z",
     "iopub.status.idle": "2026-08-15T22:28:54.449848Z",
     "shell.execute_reply": "2026-08-15T22:28:54.449476Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "  /\\  \n",
      " /  \\ \n",
      "/____\\\n"
     ]
    }
   ],
   "source": [
    "print(\"  /\\\\  \")\n",
    "print(\" /  \\\\ \")\n",
    "print(\"/____\\\\\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "34742d90",
   "metadata": {},
   "source": [
    "## Zadanie dodatkowe ★★★\n",
    "\n",
    "`print()` może przyjmować kilka wartości oddzielonych przecinkami jednocześnie, w takim przypadku wyświetlane są w jednym\n",
    "linię oddzieloną spację. Wyjście za pomocą jednego polecenia `print()` trzy różne znaczenia: tekst, liczba oraz\n",
    "wynik wyrażenia arytmetycznego."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "ea50acd2",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-15T22:28:54.450792Z",
     "iopub.status.busy": "2026-08-15T22:28:54.450681Z",
     "iopub.status.idle": "2026-08-15T22:28:54.452764Z",
     "shell.execute_reply": "2026-08-15T22:28:54.452405Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Результат: 6 42\n"
     ]
    }
   ],
   "source": [
    "print(\"Результат:\", 6, 7 * 6)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c1eb16ae",
   "metadata": {},
   "source": [
    "## Zerknijmy do środka: type()\n",
    "\n",
    "Każda wartość w Python ma swój typ — tekst, liczbę, liczbę dziesiętną i tak dalej. Funkcja `type()` pokazuje typ bezpośrednio w interpreterze, bez żadnych dodatkowych narzędzi."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "24d279bd",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-15T22:28:54.453911Z",
     "iopub.status.busy": "2026-08-15T22:28:54.453799Z",
     "iopub.status.idle": "2026-08-15T22:28:54.456061Z",
     "shell.execute_reply": "2026-08-15T22:28:54.455676Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'str'>\n",
      "<class 'int'>\n",
      "<class 'float'>\n"
     ]
    }
   ],
   "source": [
    "print(type(\"Привет\"))\n",
    "print(type(42))\n",
    "print(type(3.14))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1a9ca37c",
   "metadata": {},
   "source": [
    "## Zapytajmy Python: help()\n",
    "\n",
    "Python potrafi się wyjaśnić. Funkcja `help()` pokazuje wbudowaną pomoc dla dowolnej funkcji — tę samą, która jest w oficjalnej dokumentacji na docs.python.org, ale bezpośrednio w interpreterze, bez przeglądarki."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "a3875f04",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-15T22:28:54.457037Z",
     "iopub.status.busy": "2026-08-15T22:28:54.456930Z",
     "iopub.status.idle": "2026-08-15T22:28:54.459383Z",
     "shell.execute_reply": "2026-08-15T22:28:54.458922Z"
    }
   },
   "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"
     ]
    }
   ],
   "source": [
    "help(print)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "87c1f48e",
   "metadata": {},
   "source": [
    "## Easter egg: Zen Python\n",
    "\n",
    "Python ma własne lista zasady — „Zen Python”"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "e511649a",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-15T22:28:54.460385Z",
     "iopub.status.busy": "2026-08-15T22:28:54.460182Z",
     "iopub.status.idle": "2026-08-15T22:28:54.472743Z",
     "shell.execute_reply": "2026-08-15T22:28:54.472268Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Zen of Python, by Tim Peters\n",
      "\n",
      "Beautiful is better than ugly.\n",
      "Explicit is better than implicit.\n",
      "Simple is better than complex.\n",
      "Complex is better than complicated.\n",
      "Flat is better than nested.\n",
      "Sparse is better than dense.\n",
      "Readability counts.\n",
      "Special cases aren't special enough to break the rules.\n",
      "Although practicality beats purity.\n",
      "Errors should never pass silently.\n",
      "Unless explicitly silenced.\n",
      "In the face of ambiguity, refuse the temptation to guess.\n",
      "There should be one-- and preferably only one --obvious way to do it.\n",
      "Although that way may not be obvious at first unless you're Dutch.\n",
      "Now is better than never.\n",
      "Although never is often better than *right* now.\n",
      "If the implementation is hard to explain, it's a bad idea.\n",
      "If the implementation is easy to explain, it may be a good idea.\n",
      "Namespaces are one honking great idea -- let's do more of those!\n"
     ]
    }
   ],
   "source": [
    "import this"
   ]
  }
 ],
 "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
}
