class Solution:
dic = []
dic.append({"key": 1000, "value": "M"})
dic.append({"key": 900, "value": "CM"})
dic.append({"key": 500, "value": "D"})
dic.append({"key": 400, "value": "CD"})
dic.append({"key": 100, "value": "C"})
dic.append({"key": 90, "value": "XC"})
dic.append({"key": 50, "value": "L"})
dic.append({"key": 40, "value": "XL"})
dic.append({"key": 10, "value": "X"})
dic.append({"key": 9, "value": "IX"})
dic.append({"key": 5, "value": "V"})
dic.append({"key": 4, "value": "IV"})
dic.append({"key": 1, "value": "I"})
def intToRoman(self, num):
"""
:type num: int
:rtype: str
"""
result = ""
for obj in self.dic:
while num >= obj["key"]:
num -= obj["key"]
result += obj["value"]
print(result)
return result