{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "ff2f9dc2",
   "metadata": {},
   "source": [
    "# 11-04 · Jeszcze więcej o listach\n",
    "\n",
    "Praktyka do sekcji [„Jeszcze ciekawsze rzeczy z listami!”"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ca8e2ed3",
   "metadata": {},
   "source": [
    "## Cel\n",
    "\n",
    "Master len/min/max/sum, listy zagnieżdżone i list comprehension."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bfaee18b",
   "metadata": {},
   "source": [
    "## Sprawa robocza"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "be301da6",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-17T14:44:22.840984Z",
     "iopub.status.busy": "2026-08-17T14:44:22.840880Z",
     "iopub.status.idle": "2026-08-17T14:44:22.864683Z",
     "shell.execute_reply": "2026-08-17T14:44:22.864215Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "6 4 42 108\n"
     ]
    }
   ],
   "source": [
    "chisla = [4, 8, 15, 16, 23, 42]\n",
    "print(len(chisla), min(chisla), max(chisla), sum(chisla))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c804697f",
   "metadata": {},
   "source": [
    "## Eksperyment 1 - Zagnieżdżone listy"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "b54600c2",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-17T14:44:22.865717Z",
     "iopub.status.busy": "2026-08-17T14:44:22.865606Z",
     "iopub.status.idle": "2026-08-17T14:44:22.867969Z",
     "shell.execute_reply": "2026-08-17T14:44:22.867496Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1, 2, 3]\n",
      "2\n",
      "6\n"
     ]
    }
   ],
   "source": [
    "matrix = [[1, 2, 3], [4, 5, 6]]\n",
    "print(matrix[0])\n",
    "print(matrix[0][1])\n",
    "print(matrix[1][2])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1e025a36",
   "metadata": {},
   "source": [
    "## Eksperyment 2 – list comprehension"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "8739fa54",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-17T14:44:22.868863Z",
     "iopub.status.busy": "2026-08-17T14:44:22.868760Z",
     "iopub.status.idle": "2026-08-17T14:44:22.871354Z",
     "shell.execute_reply": "2026-08-17T14:44:22.870852Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1, 4, 9, 16, 25]\n",
      "[2, 4, 6, 8, 10, 12, 14, 16, 18]\n"
     ]
    }
   ],
   "source": [
    "kvadraty = [n ** 2 for n in range(1, 6)]\n",
    "print(kvadraty)\n",
    "\n",
    "chetnye = [n for n in range(1, 20) if n % 2 == 0]\n",
    "print(chetnye)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5d21a616",
   "metadata": {},
   "source": [
    "## Podstawowa praktyka zadań ★\n",
    "\n",
    "Zbuduj lista sześcianów liczb od 1 do 10 na dwa sposoby: pętlą append() oraz generatorem list."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "b83c8686",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-17T14:44:22.872293Z",
     "iopub.status.busy": "2026-08-17T14:44:22.872194Z",
     "iopub.status.idle": "2026-08-17T14:44:22.874709Z",
     "shell.execute_reply": "2026-08-17T14:44:22.874277Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1, 8, 27, 64, 125, 216, 343, 512, 729, 1000]\n",
      "True\n"
     ]
    }
   ],
   "source": [
    "kuby_v1 = []\n",
    "for n in range(1, 11):\n",
    "    kuby_v1.append(n ** 3)\n",
    "\n",
    "kuby_v2 = [n ** 3 for n in range(1, 11)]\n",
    "\n",
    "print(kuby_v1)\n",
    "print(kuby_v1 == kuby_v2)"
   ]
  }
 ],
 "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
}
