{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "3639a79a-9147-4864-a4a7-3cc4b87985d4",
   "metadata": {},
   "outputs": [],
   "source": [
    "from roman import RomanNumeral"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a4b4ddbb-773a-467b-8294-8d97f1833a6d",
   "metadata": {},
   "source": [
    "### **PROBLEM 1** [20 points]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6af173e6-6bca-4d90-8063-6b045e915b14",
   "metadata": {},
   "outputs": [],
   "source": [
    "for i in [1776, 1947, 1949, 1999, 2001, 2023]:\n",
    "    print()\n",
    "    display(RomanNumeral(i))\n",
    "    print('print: ', RomanNumeral(i))\n",
    "    print(f'{RomanNumeral(i).roman = }')\n",
    "    print(f'{RomanNumeral(i).value = }')"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2e28c75c-f3d3-4ef7-b1e2-6d7a919cd0b6",
   "metadata": {},
   "source": [
    "### **PROBLEM 2** [20 points]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a33cbacb-2e04-42a4-97a8-fe3988c3ba72",
   "metadata": {},
   "outputs": [],
   "source": [
    "for r in ['MDCCLXXVI', 'MCMXLVII', 'MCMXLIX', 'MCMXCIX', 'MMI', 'MMXXIII']:\n",
    "    print(f'{r:10}: {RomanNumeral(r).value}')"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f0081cc2-8805-4b69-a50e-258c6c6266e9",
   "metadata": {},
   "source": [
    "### **PROBLEM 3** [20 points]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e1eae3ac-42a9-4ee2-9e38-48a1e55c7947",
   "metadata": {},
   "outputs": [],
   "source": [
    "for r in ['MMC', 'MCM', 'DCC', 'CD', 'CCX', 'CXC', \n",
    "          'LXX', 'LX', 'XXI', 'XIX', 'VII', 'IV', 'III']:\n",
    "    print()\n",
    "    print(f'{RomanNumeral(r) = }')\n",
    "    print(f'{RomanNumeral(RomanNumeral(r).value) = }')"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d52c7f8e-bcd1-4eda-baa9-c05ac083789a",
   "metadata": {},
   "source": [
    "### **PROBLEM 4:** [40 points] Read and process file `expressions.txt`\n",
    "```\n",
    "MCMLXIII + LVI\n",
    "MMI - XXXIII\n",
    "LIII * XXXIII\n",
    "MMI // XXXIII\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "847440f7-daa6-49d4-8e94-8c4c6773fdf0",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "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.11.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
