https://github.com/elucidation/romannumeralspy
Function for turning Integers to Roman Numerals and back using Python
https://github.com/elucidation/romannumeralspy
Last synced: 11 months ago
JSON representation
Function for turning Integers to Roman Numerals and back using Python
- Host: GitHub
- URL: https://github.com/elucidation/romannumeralspy
- Owner: Elucidation
- Created: 2012-08-14T07:24:43.000Z (almost 14 years ago)
- Default Branch: master
- Last Pushed: 2012-08-14T07:47:35.000Z (almost 14 years ago)
- Last Synced: 2025-02-10T00:17:06.962Z (over 1 year ago)
- Language: Python
- Size: 97.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
Awesome Lists containing this project
README
Basic implementation of functions to convert integers to roman numerals and back via roman() and unroman() respectively.
Roman Numerals used the summed value of letters to represent a number.
```
Symbol Value
I 1
V 5
X 10
L 50
C 100
D 500
M 1,000
```
Example output when running test cases through it:
```
X : roman(X) : unroman(roman(x))
-------------------------------------------
-5 : -V : -5
-4 : -IV : -4
-3 : -III : -3
-2 : -II : -2
-1 : -I : -1
0 : : 0
1 : I : 1
2 : II : 2
3 : III : 3
4 : IV : 4
5 : V : 5
6 : VI : 6
7 : VII : 7
8 : IIX : 8
9 : IX : 9
10 : X : 10
11 : XI : 11
12 : XII : 12
13 : XIII : 13
14 : XIV : 14
15 : XV : 15
16 : XVI : 16
17 : XVII : 17
18 : XIIX : 18
19 : XIX : 19
81 : XXCI : 81
256 : CCLVI : 256
625 : DCXXV : 625
1296 : MCCXCVI : 1296
2401 : MMCDI : 2401
4096 : MMMMXCVI : 4096
6561 : MMMMMMDLXI : 6561
[Finished in 0.1s]
```