Beispiel #1
0
 def test_roman_to_int(self):
     self.assertEqual(621, roman_to_int("DCXXI"))
     self.assertEqual(1, roman_to_int("I"))
     self.assertEqual(3999, roman_to_int("MMMCMXCIX"))
Beispiel #2
0
 def test_roman_to_int(self):
     self.assertEqual(621, roman_to_int("DCXXI"))
     self.assertEqual(1, roman_to_int("I"))
     self.assertEqual(3999, roman_to_int("MMMCMXCIX"))
Beispiel #3
0
"""
Given a roman numeral, convert it to an integer.
Input is guaranteed to be within the range from 1 to 3999.
"""

from algorithms.strings import roman_to_int

roman = "DCXXI"
print(roman_to_int(roman))