Skip to content

Instantly share code, notes, and snippets.

@gregturn
Created September 10, 2010 15:54
Show Gist options
  • Save gregturn/573874 to your computer and use it in GitHub Desktop.
Save gregturn/573874 to your computer and use it in GitHub Desktop.
class RomanNumeralConverter(object):
def __init__(self):
self.digit_map = {"M":1000, "D":500, "C":100, "L":50, "X":10, "V":5, "I":1}
def convert_to_decimal(self, roman_numeral):
val = 0
for char in roman_numeral:
val += self.digit_map[char]
return val
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment