Log inBook a Demo
BuildJuniorBackendAuto-graded

Fix a converter that writes 4 as IIII

Make a Roman numeral converter correct in both directions and reject invalid input.Users are filing bugs against the Roman-numeral converter in roman.py. It writes 4 as IIII and 40 as XXXX, reads IX back as 11, and accepts nonsense like VX. Fix int_to_roman and roman_to_int so every number from 1 to 3999 gets its one canonical numeral and parses back to the same value, and invalid input raises ValueError.
25 min
python

You're done when

  • int_to_roman returns the canonical numeral, subtractive forms like IV and CM included, for a set of reference numbers.
  • roman_to_int returns the right value for the canonical numerals of those same numbers.
  • Every number from 1 to 3999 converts to its single canonical spelling.
  • Invalid numerals such as IIII or VX raise ValueError.

What it measures

Data structures and algorithmsHow both conversions handle subtractive pairs such as `IV`, `XC` and `CM`.
PythonClear code for both functions, with input checked in each.
Full-range checkingWhether you checked results across all of 1 to 3999 or just a few familiar numbers.

Your environment

Terminal + editorA full shell in the browser
Coding agentAlready signed in, no API key to set up
Isolated workspaceOnly yours, wiped when you finish

Start this lab

25 min
Start labYou'll need to sign in to Anthropos first. The lab opens in a private cloud workspace with your coding agent ready to use.
AI Labs is part of Anthropos Workforce. Not on your plan yet? Book a demo