{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "aded4594",
   "metadata": {},
   "source": [
    "# 12-15 · Koszyk zakupowy\n",
    "\n",
    "Praktyka do [„Projekty: Księga ocen i wózek na zakupy”"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4810b5e1",
   "metadata": {},
   "source": [
    "## Cel\n",
    "\n",
    "Lista słowników + przejazd: paragon i całkowita kwota."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7938cca1",
   "metadata": {},
   "source": [
    "## Sprawa robocza"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "39fdf704",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-17T16:38:43.410423Z",
     "iopub.status.busy": "2026-08-17T16:38:43.410314Z",
     "iopub.status.idle": "2026-08-17T16:38:43.428893Z",
     "shell.execute_reply": "2026-08-17T16:38:43.428435Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Молоко     2 x 4.50 = 9.00\n",
      "Хлеб       1 x 2.20 = 2.20\n",
      "Сыр        1 x 9.90 = 9.90\n",
      "Итого: 21.10\n"
     ]
    }
   ],
   "source": [
    "cart = [\n",
    "    {\"name\": \"Молоко\", \"price\": 4.50, \"qty\": 2},\n",
    "    {\"name\": \"Хлеб\", \"price\": 2.20, \"qty\": 1},\n",
    "    {\"name\": \"Сыр\", \"price\": 9.90, \"qty\": 1},\n",
    "]\n",
    "\n",
    "total = 0\n",
    "for item in cart:\n",
    "    line_total = item[\"price\"] * item[\"qty\"]\n",
    "    total += line_total\n",
    "    print(f\"{item['name']:<10} {item['qty']} x {item['price']:.2f} = {line_total:.2f}\")\n",
    "\n",
    "total = round(total, 2)\n",
    "print(f\"Итого: {total:.2f}\")"
   ]
  }
 ],
 "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
}
