{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "cda32842",
   "metadata": {},
   "source": [
    "# 19-25 · High Score\n",
    "\n",
    "Praktyka do sekcji [„High Score”"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6c93343c",
   "metadata": {},
   "source": [
    "## Cel\n",
    "\n",
    "score zawsze od zera przy restartu; high_score jest aktualizowany co max() i przetrwa restart."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2b2d170b",
   "metadata": {},
   "source": [
    "## Sprawa robocza"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "81112988",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-09-03T00:54:17.262925Z",
     "iopub.status.busy": "2026-09-03T00:54:17.262782Z",
     "iopub.status.idle": "2026-09-03T00:54:17.290557Z",
     "shell.execute_reply": "2026-09-03T00:54:17.290039Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "10 40\n"
     ]
    }
   ],
   "source": [
    "def update_high_score(score, high_score):\n",
    "    return max(score, high_score)\n",
    "\n",
    "score, high_score = 0, 40\n",
    "score += 10\n",
    "high_score = update_high_score(score, high_score)\n",
    "print(score, high_score)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "252163ca",
   "metadata": {},
   "source": [
    "## Podstawowa praktyka zadań ★"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "ce52295c",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-09-03T00:54:17.291782Z",
     "iopub.status.busy": "2026-09-03T00:54:17.291653Z",
     "iopub.status.idle": "2026-09-03T00:54:17.294323Z",
     "shell.execute_reply": "2026-09-03T00:54:17.293825Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "high_score никогда не уменьшается — только растёт или остаётся прежним.\n"
     ]
    }
   ],
   "source": [
    "assert update_high_score(30, 40) == 40    # рекорд не понижается\n",
    "assert update_high_score(50, 40) == 50    # но обновляется, если счёт его превысил\n",
    "assert update_high_score(0, 0) == 0\n",
    "print(\"high_score никогда не уменьшается — только растёт или остаётся прежним.\")"
   ]
  }
 ],
 "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
}
