Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def checkio(data):
- roman_dict = {"I": 1, "V": 5, "X": 10, "L": 50, "C": 100, "D": 500, "M": 1000}
- def dig_to_roman(data, result):
- if data > roman_dict["M"]:
- print(data)
- dig_to_roman(data-roman_dict["M"], result + "M")
- else:
- #print("PRINT RESULT ", result)
- return result
- return dig_to_roman(data, "")
- # if __name__ == '__main__':
- # #These "asserts" using only for self-checking and not necessary for auto-testing
- # assert checkio(6) == 'VI', '6'
- # assert checkio(76) == 'LXXVI', '76'
- # assert checkio(499) == 'CDXCIX', '499'
- # assert checkio(3888) == 'MMMDCCCLXXXVIII', '3888'
- print(checkio(4888))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement