Open In App

Converting Roman to Decimal in Python using gnboorse-rom module

A gnboorse-rom module is that library of python which helps you convert roman numerals into decimal number and decimal number into roman numerals .It will do conversion of values upto 3999 both in roman numerals and decimal system .

Note: Following is the list of some unique Roman symbols with their corresponding decimal 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       

A number in Roman Numerals is a string of these symbols written in descending order(e.g. M’s first, followed by D’s, etc.). However, in a few specific cases, to avoid four characters being repeated in succession (such as IIII or XXXX), subtractive notation is often used as follows:

Installing Library

This module does not come built-in with Python. You need to install it externally. To install this module type the below command in the terminal.



pip install gnboorse-rom

Functions of gnboorse-rom :

Note: For understanding of code behind the logic you can refer to GeeksforGeeks


Article Tags :