Created
September 10, 2010 15:55
-
-
Save gregturn/573875 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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