Description
The Converting_Roman_to_Integer script has several usability bugs, unhandled exceptions, and missing features:
- Unhandled
IndexError: Running python Converting_Roman_to_Integer.py with no CLI arguments throws an unhandled IndexError: list index out of range on sys.argv[1].
- Case Sensitivity & Whitespace Failures: Providing lowercase Roman numerals (
xiv) or inputs with whitespace causes unhandled KeyError crashes.
- No Syntax / Character Validation: Non-Roman characters (
ABC, 123) or invalid combinations (IIII, VV, IC) result in crashes or invalid numbers without informative error messages.
- Shadowing Built-in Identifier: The script defines
dict = {...}, shadowing Python's built-in dict type.
- No Modular Structure: Logic is placed at module top-level without reusable functions or
if __name__ == '__main__': guards.
- Incomplete README:
README.md is minimal (3 lines) and does not adhere to README_TEMPLATE.md.
Type of issue
Checklist:
Description
The
Converting_Roman_to_Integerscript has several usability bugs, unhandled exceptions, and missing features:IndexError: Runningpython Converting_Roman_to_Integer.pywith no CLI arguments throws an unhandledIndexError: list index out of rangeonsys.argv[1].xiv) or inputs with whitespace causes unhandledKeyErrorcrashes.ABC,123) or invalid combinations (IIII,VV,IC) result in crashes or invalid numbers without informative error messages.dict = {...}, shadowing Python's built-indicttype.if __name__ == '__main__':guards.README.mdis minimal (3 lines) and does not adhere toREADME_TEMPLATE.md.Type of issue
Checklist:
I have read the project guidelines.
I have checked previous issues to avoid duplicates.
This issue will be meaningful for the project.
I have added steps to reproduce the bug:
python Converting_Roman_to_Integer/Converting_Roman_to_Integer.pywithout arguments -> Crashes withIndexError.python Converting_Roman_to_Integer/Converting_Roman_to_Integer.py xiv-> Crashes withKeyError.python Converting_Roman_to_Integer/Converting_Roman_to_Integer.py IIII-> Incorrectly prints 4 without validation error.I have proposed a possible solution for the bug:
.strip().upper()) and regex syntax validation.roman_to_int(roman)andint_to_roman(num).README.md.