Skip to content

Instantly share code, notes, and snippets.

@arose13
Created January 13, 2017 04:45
Show Gist options
  • Save arose13/c0ad9f8857c352cd297ae45d76bbdbd4 to your computer and use it in GitHub Desktop.
Save arose13/c0ad9f8857c352cd297ae45d76bbdbd4 to your computer and use it in GitHub Desktop.
def checkio(data):
soln = {
1: 'I',
4: 'IV',
5: 'V',
9: 'IX',
10: 'X',
40: 'XL',
50: 'L',
90: 'XC',
100: 'C',
400: 'CD',
500: 'D',
900: 'CM',
1000: 'M'
}
result = ''
for number in reversed(sorted(list(soln.keys()))):
result += soln[number] * (data // number)
data %= number
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment