{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "a8306c53",
   "metadata": {},
   "source": [
    "# 08-18 · Iteracja na łańcuch znaków w pętli\n",
    "\n",
    "Praktyka do sekcji [„Iterating over a line in a loop”"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "82f84d38",
   "metadata": {},
   "source": [
    "## Cel\n",
    "\n",
    "Przewiń for linii i ręcznie licz liczbę wystąpień znaku."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4406c5b4",
   "metadata": {},
   "source": [
    "## Sprawa robocza"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "cdd04ddb",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T16:18:57.734810Z",
     "iopub.status.busy": "2026-08-16T16:18:57.734683Z",
     "iopub.status.idle": "2026-08-16T16:18:57.757924Z",
     "shell.execute_reply": "2026-08-16T16:18:57.757080Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "P\n",
      "y\n",
      "t\n",
      "h\n",
      "o\n",
      "n\n"
     ]
    }
   ],
   "source": [
    "word = \"Python\"\n",
    "for ch in word:\n",
    "    print(ch)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9eb4b34d",
   "metadata": {},
   "source": [
    "## Podstawowa praktyka zadań ★\n",
    "\n",
    "W linii \"mississippi\" licz w pętli for liczbę razy, ile litera \"i\" pojawia się – zapisz wynik w `count`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "87191ecb",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T16:18:57.759869Z",
     "iopub.status.busy": "2026-08-16T16:18:57.759702Z",
     "iopub.status.idle": "2026-08-16T16:18:57.762558Z",
     "shell.execute_reply": "2026-08-16T16:18:57.762083Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "4\n"
     ]
    }
   ],
   "source": [
    "text = \"миссисипи\"\n",
    "bukva = \"и\"\n",
    "count = 0\n",
    "for ch in text:\n",
    "    if ch == bukva:\n",
    "        count += 1\n",
    "print(count)"
   ]
  }
 ],
 "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
}
