Python Script for Roman Numerals
Here a python script for Roman Numerals:
romanNumerals = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000}
def getRomanNumerals(value):
string = value.upper()
total = 0
while string:
if len(string) == 1 or romanNumerals[string[0]] >= romanNumerals[string[1]]:
total += romanNumerals[string[0]]
string = string[1:]
else:
total += romanNumerals[string[1]] - romanNumerals[string[0]]
string = string[2:]
return total