{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "01b64836",
   "metadata": {},
   "source": [
    "# 10-01 · Cykle for\n",
    "\n",
    "Praktyka do sekcji [„Magiczne Cykle! Cykle for”"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a00b6417",
   "metadata": {},
   "source": [
    "## Cel\n",
    "\n",
    "opanować cykl for i range()."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b97495e4",
   "metadata": {},
   "source": [
    "## Sprawa robocza"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "08872e16",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T20:12:43.592309Z",
     "iopub.status.busy": "2026-08-16T20:12:43.592193Z",
     "iopub.status.idle": "2026-08-16T20:12:43.609758Z",
     "shell.execute_reply": "2026-08-16T20:12:43.609269Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n",
      "1\n",
      "2\n",
      "3\n",
      "4\n"
     ]
    }
   ],
   "source": [
    "for i in range(5):\n",
    "    print(i)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1616e41c",
   "metadata": {},
   "source": [
    "## Eksperyment 1 – range z początkiem i końcem"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "85f4bad9",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T20:12:43.610755Z",
     "iopub.status.busy": "2026-08-16T20:12:43.610643Z",
     "iopub.status.idle": "2026-08-16T20:12:43.613035Z",
     "shell.execute_reply": "2026-08-16T20:12:43.612565Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2\n",
      "3\n",
      "4\n",
      "5\n",
      "6\n",
      "7\n"
     ]
    }
   ],
   "source": [
    "for i in range(2, 8):\n",
    "    print(i)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a081d290",
   "metadata": {},
   "source": [
    "## Eksperyment 2 — range z krokiem"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "0dc3a38e",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T20:12:43.613894Z",
     "iopub.status.busy": "2026-08-16T20:12:43.613794Z",
     "iopub.status.idle": "2026-08-16T20:12:43.615996Z",
     "shell.execute_reply": "2026-08-16T20:12:43.615557Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n",
      "2\n",
      "4\n",
      "6\n",
      "8\n"
     ]
    }
   ],
   "source": [
    "for i in range(0, 10, 2):\n",
    "    print(i)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "44d09749",
   "metadata": {},
   "source": [
    "## Podstawowa praktyka zadań ★\n",
    "\n",
    "Wypisz tablicę mnożenia liczby 7 (7×1 do 7×10)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "09fc52c8",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T20:12:43.616922Z",
     "iopub.status.busy": "2026-08-16T20:12:43.616820Z",
     "iopub.status.idle": "2026-08-16T20:12:43.618901Z",
     "shell.execute_reply": "2026-08-16T20:12:43.618547Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "7 x 1 = 7\n",
      "7 x 2 = 14\n",
      "7 x 3 = 21\n",
      "7 x 4 = 28\n",
      "7 x 5 = 35\n",
      "7 x 6 = 42\n",
      "7 x 7 = 49\n",
      "7 x 8 = 56\n",
      "7 x 9 = 63\n",
      "7 x 10 = 70\n"
     ]
    }
   ],
   "source": [
    "for i in range(1, 11):\n",
    "    print(f\"7 x {i} = {7 * i}\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b06f0269",
   "metadata": {},
   "source": [
    "## Zadanie dodatkowe ★★★\n",
    "\n",
    "Oblicz sumę wszystkich liczb od 1 do 100 w cyklu (bez wzoru)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "c1270368",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T20:12:43.620126Z",
     "iopub.status.busy": "2026-08-16T20:12:43.619807Z",
     "iopub.status.idle": "2026-08-16T20:12:43.622376Z",
     "shell.execute_reply": "2026-08-16T20:12:43.621933Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "5050\n"
     ]
    }
   ],
   "source": [
    "total = 0\n",
    "for i in range(1, 101):\n",
    "    total += i\n",
    "print(total)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9239d1dc",
   "metadata": {},
   "source": [
    "## Sprawdzenie wyniku"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "45af813e",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T20:12:43.623288Z",
     "iopub.status.busy": "2026-08-16T20:12:43.623182Z",
     "iopub.status.idle": "2026-08-16T20:12:43.625270Z",
     "shell.execute_reply": "2026-08-16T20:12:43.624913Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Верно: сумма чисел от 1 до 100 равна 5050.\n"
     ]
    }
   ],
   "source": [
    "assert sum(range(1, 101)) == 5050\n",
    "print(\"Верно: сумма чисел от 1 до 100 равна 5050.\")"
   ]
  }
 ],
 "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
}
