Your question is Roman Numeral Converter. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Appfolio applications may need to display ordinal-style labels or parse legacy Roman numeral values. Implement a clean, class-based converter that supports both Roman numeral to integer and integer to Roman numeral conversions with strict validation.
Create RomanNumeralConverter with a public method that accepts a value and a direction:
direction = "to_integer", value must be a canonical uppercase Roman numeral and the method returns an integer.direction = "to_roman", value must be an integer from 1 through 3999 and the method returns its canonical uppercase Roman numeral.ValueError for malformed Roman numerals, unsupported directions, integers outside the allowed range, booleans, or values of the wrong type.convert_roman(value, direction) that uses the class.Canonical notation allows I, V, X, L, C, D, and M, including only valid subtractive pairs such as IV, IX, XL, XC, CD, and CM.
def convert_roman(value, direction):