{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "cfc89da3",
   "metadata": {},
   "source": [
    "# 10-18 · Off-by-one – liczyć iteracje\n",
    "\n",
    "Praktyka do rozdziału [„Debugowanie pętli”](/pl/chapters/rozdzial-10/10-13-otladka-ciklov.html#off-by-one-otdelnyj-razbor)."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3f6b1a15",
   "metadata": {},
   "source": [
    "## Cel\n",
    "\n",
    "Ćwicz dokładne wyznaczanie granic range() dla konkretnego zadania."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "24a45d10",
   "metadata": {},
   "source": [
    "## Podstawowa praktyka zadań ★\n",
    "\n",
    "Zrównaj liczby od 5 do 15 włącznie w `diapazon`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "cb3eb101",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T20:12:54.786652Z",
     "iopub.status.busy": "2026-08-16T20:12:54.786537Z",
     "iopub.status.idle": "2026-08-16T20:12:54.805648Z",
     "shell.execute_reply": "2026-08-16T20:12:54.805172Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]\n"
     ]
    }
   ],
   "source": [
    "diapazon = []\n",
    "for n in range(5, 16):\n",
    "    diapazon.append(n)\n",
    "print(diapazon)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ecdf528f",
   "metadata": {},
   "source": [
    "## Zadanie ★★ - Spadające Pasmo\n",
    "\n",
    "Zbieraj parzyste liczby od 20 do 2 włącznie, w kolejności malejącej, w `ubyvanie`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "64223799",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T20:12:54.806634Z",
     "iopub.status.busy": "2026-08-16T20:12:54.806523Z",
     "iopub.status.idle": "2026-08-16T20:12:54.808714Z",
     "shell.execute_reply": "2026-08-16T20:12:54.808421Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[20, 18, 16, 14, 12, 10, 8, 6, 4, 2]\n"
     ]
    }
   ],
   "source": [
    "ubyvanie = []\n",
    "for n in range(20, 1, -2):\n",
    "    ubyvanie.append(n)\n",
    "print(ubyvanie)"
   ]
  }
 ],
 "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
}
