{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "bebca7c0",
   "metadata": {},
   "source": [
    "# 13-26 · Konwerter jednostkowy\n",
    "\n",
    "Praktyka do sekcji [„Mini-projekty – konwertery i narzędzia kolekcjonarskie”"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8a510839",
   "metadata": {},
   "source": [
    "## Cel\n",
    "\n",
    "Zapisz zestaw czystych funkcji konwertera i przetestuj je przez assert."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9f670605",
   "metadata": {},
   "source": [
    "## Podstawowa praktyka zadań ★"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "a5703a4f",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2026-08-17T18:54:22.756644Z",
     "iopub.status.busy": "2026-08-17T18:54:22.756478Z",
     "iopub.status.idle": "2026-08-17T18:54:22.772916Z",
     "shell.execute_reply": "2026-08-17T18:54:22.772480Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "32.0 212.0 0.0 6.21\n"
     ]
    }
   ],
   "source": [
    "def celsius_to_fahrenheit(celsius: float) -> float:\n",
    "    return celsius * 9 / 5 + 32\n",
    "\n",
    "def fahrenheit_to_celsius(fahrenheit: float) -> float:\n",
    "    return (fahrenheit - 32) * 5 / 9\n",
    "\n",
    "def km_to_miles(km: float) -> float:\n",
    "    return km * 0.621371\n",
    "\n",
    "f1 = celsius_to_fahrenheit(0)\n",
    "f2 = celsius_to_fahrenheit(100)\n",
    "c1 = fahrenheit_to_celsius(32)\n",
    "miles = round(km_to_miles(10), 2)\n",
    "\n",
    "assert f1 == 32\n",
    "assert f2 == 212\n",
    "print(f1, f2, c1, miles)"
   ]
  }
 ],
 "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
}
