0

I need to convert a number (in decimal form) that is between 1 to 4999 to Roman Numeral Form. However, though the code I have is kinda working, its only outputting the thousand digit, not anything less or any part thats less.

```
def int2roman(number):
numerals={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 value, numeral in sorted(numerals.items(), reverse=True):
while number >= value:
result += numeral
number -= value
return result
print int2roman(input("Enter a number (1 to 4999) in decimal form: "))
```

if I input 1994, I get M instead of the MCMXCIV I should be getting. Any corrections and explanations to my code?

Thanks :)