Loading...
The Roman Converter
A easy Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- easy
- Seniority
- junior, mid
Problem
Our historical data pipeline ingests dates stored as Roman numerals. Write a function called roman_to_int that takes a Roman numeral string and returns its integer value. Valid symbols are I(1), V(5), X(10), L(50), C(100), D(500), M(1000). When a smaller value appears before a larger one, it is subtracted (IV = 4, IX = 9).
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a sandboxed Docker environment and grades it instantly.