← Back to challenges

Roman Numeral Converter

PythonHardarraysdata_structuresnumbers

Instructions

Create a function that takes an Arabic number and converts it into a Roman number.

Examples

convert_to_roman(2) ➞ "II"

convert_to_roman(12) ➞ "XII"

convert_to_roman(16) ➞ "XVI"

Notes

  • All roman numerals should be returned as uppercase.
  • The largest number that can be represented in this notation is 3,999.
python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.