{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "f37f58b9",
   "metadata": {},
   "source": [
    "# 04-21 · statistics, inf i nan\n",
    "\n",
    "Praktyka do sekcji [„statistics, inf i nan”"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2bab4563",
   "metadata": {},
   "source": [
    "## Cel\n",
    "\n",
    "Opanować statistics.mean/median i rozpoznawanie inf/nan."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b6a7f805",
   "metadata": {},
   "source": [
    "## Sprawa robocza"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "7e950faa",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T10:04:04.472144Z",
     "iopub.status.busy": "2026-08-16T10:04:04.471990Z",
     "iopub.status.idle": "2026-08-16T10:04:04.504669Z",
     "shell.execute_reply": "2026-08-16T10:04:04.504092Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "86.6\n"
     ]
    }
   ],
   "source": [
    "import statistics\n",
    "scores = [85, 90, 78, 92, 88]\n",
    "print(statistics.mean(scores))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "47f1b10f",
   "metadata": {},
   "source": [
    "## Eksperyment 1\n",
    "\n",
    "Sprawdź medianę tej samej listy."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "ee50f921",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T10:04:04.505731Z",
     "iopub.status.busy": "2026-08-16T10:04:04.505615Z",
     "iopub.status.idle": "2026-08-16T10:04:04.507882Z",
     "shell.execute_reply": "2026-08-16T10:04:04.507514Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "88\n"
     ]
    }
   ],
   "source": [
    "import statistics\n",
    "scores = [85, 90, 78, 92, 88]\n",
    "print(statistics.median(scores))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "301ff009",
   "metadata": {},
   "source": [
    "## Eksperyment 2\n",
    "\n",
    "Sprawdź dziwną właściwość nan."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "703c85ba",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T10:04:04.508945Z",
     "iopub.status.busy": "2026-08-16T10:04:04.508841Z",
     "iopub.status.idle": "2026-08-16T10:04:04.510931Z",
     "shell.execute_reply": "2026-08-16T10:04:04.510590Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "False\n"
     ]
    }
   ],
   "source": [
    "x = float(\"nan\")\n",
    "print(x == x)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e942d5c5",
   "metadata": {},
   "source": [
    "## Podstawowa praktyka zadań ★\n",
    "\n",
    "Sprawdź float( inf\") math.isinf()."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "85758160",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-16T10:04:04.513784Z",
     "iopub.status.busy": "2026-08-16T10:04:04.513616Z",
     "iopub.status.idle": "2026-08-16T10:04:04.516214Z",
     "shell.execute_reply": "2026-08-16T10:04:04.515610Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "True\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "y = float(\"inf\")\n",
    "print(math.isinf(y))"
   ]
  }
 ],
 "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
}
