Created
January 13, 2017 04:45
-
-
Save arose13/c0ad9f8857c352cd297ae45d76bbdbd4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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