Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Roman Numerals by SWalrus
import re
def checkio(data):
result = "I" * data
result = re.sub(r'IIIII', 'V', result)
result = re.sub(r'IIII', 'IV', result)
result = re.sub(r'VV', 'X', result)
result = re.sub(r'VIV', 'IX', result)
result = re.sub(r'XXXXX', 'L', result)
result = re.sub(r'XXXX', 'XL', result)
result = re.sub(r'LL', 'C', result)
result = re.sub(r'LXL', 'XC', result)
result = re.sub(r'CCCCC', 'D', result)
result = re.sub(r'CCCC', 'CD', result)
result = re.sub(r'DD', 'M', result)
result = re.sub(r'DCD', 'CM', result)
return result
Aug. 25, 2017