Rome
A practical Roman numerals implementation (also an example of Python project structure)
Install / Use
/learn @keleshev/RomeREADME
Rome
Overview
Rome is the first industrial-strength Roman numerals implementation for Python. It features Roman-to-Arabic and Arabic-to-Roman numerals convertion, as well as normalization of denormalized Roman numerals using unified object-oriented interface. It is developed using test-driven development, and features an extensive test-suite.
Installation
.. code::
pip install rome==0.0.3
Usage
.. code:: python
>>> from rome import Roman
>>> Roman('IX')
Roman('IX')
>>> str(Roman('IX'))
'IX'
>>> int(Roman('IX')) # to Arabic numerals
9
>>> Roman('IX') == 9
True
>>> Roman('IX') + Roman('XI') == Roman('XX')
True
>>> Roman('XXI') - 13 == 8
True
>>> Roman(4) # from Arabic numerals
Roman('IV')
>>> Roman(1903)
Roman('MCMIII')
>>> Roman('IIII') # bring to normalized form
Roman('IV')
>>> Roman('MDCCCCLXXXXVIIII')
Roman('MCMXCIX')
>>> int(Roman('MCMXCIX'))
1999
>>> int(Roman('M cM xC iX')) # spaces and mixed case are
... # allowed for readability
1999
Related Skills
node-connect
342.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
84.7kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
342.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
84.7kCommit, push, and open a PR
