Project: Roman Numerals
Ancient Rome used a system of numbers much different that the Hindu-Arabic numerals we use today. Today Roman Numerals are only used on movie copyrights, Olymipic games and the Superbowl. Write a program that converts the numbers from 1-2500 to [[Roman Numerals]] and prints them. Write a function that specifically does the Roman Numeral conversion. It should take an integer and return a string. The following table specifies the Roman Numerals and their corresponding integer values.
Symbol | Value |
---|---|
I | 1 |
IV | 4 |
V | 5 |
IX | 9 |
X | 10 |
XL | 40 |
L | 50 |
XC | 90 |
C | 100 |
CD | 400 |
D | 500 |
CM | 900 |
M | 1000 |
With the right algorithm, generating Roman Numerals with the subtractice notation illustrated above is as simple as the additive form.
Output
$ python RomanNumerals.py
0 =
1 = I
2 = II
3 = III
4 = IV
5 = V
6 = VI
7 = VII
8 = VIII
9 = IX
...
2491 = MMCDXCI
2492 = MMCDXCII
2493 = MMCDXCIII
2494 = MMCDXCIV
2495 = MMCDXCV
2496 = MMCDXCVI
2497 = MMCDXCVII
2498 = MMCDXCVIII
2499 = MMCDXCIX
2500 = MMD