{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "df7e2df1",
   "metadata": {},
   "source": [
    "# 08-13 · Długość linii: len()\n",
    "\n",
    "Praktyka do sekcji [„Długość linii: len()”"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "96a463d7",
   "metadata": {},
   "source": [
    "## Cel\n",
    "\n",
    "Traktuj znaki łańcuch znaków jako funkcję len() i zrozum związek między długością a indeksami."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9f17268d",
   "metadata": {},
   "source": [
    "## Sprawa robocza"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "6f1d93d1",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T16:18:54.455352Z",
     "iopub.status.busy": "2026-08-16T16:18:54.455167Z",
     "iopub.status.idle": "2026-08-16T16:18:54.477490Z",
     "shell.execute_reply": "2026-08-16T16:18:54.477063Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "6\n",
      "13\n"
     ]
    }
   ],
   "source": [
    "word = \"Python\"\n",
    "print(len(word))\n",
    "\n",
    "phrase = \"Python с нуля\"\n",
    "print(len(phrase))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "19f45164",
   "metadata": {},
   "source": [
    "## Podstawowa praktyka zadań ★\n",
    "\n",
    "Dla słowa „Cartesian” `dlina` i indeks ostatniego znaku `posledniy_index` (po len()) - upewnij się, że `word[posledniy_index]` zbiega się z `word[-1]`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "6e866b69",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T16:18:54.478486Z",
     "iopub.status.busy": "2026-08-16T16:18:54.478373Z",
     "iopub.status.idle": "2026-08-16T16:18:54.481363Z",
     "shell.execute_reply": "2026-08-16T16:18:54.480541Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "9 8\n",
      "True\n"
     ]
    }
   ],
   "source": [
    "word = \"Cartesian\"\n",
    "dlina = len(word)\n",
    "posledniy_index = dlina - 1\n",
    "print(dlina, posledniy_index)\n",
    "print(word[posledniy_index] == word[-1])"
   ]
  }
 ],
 "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
}
