We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support numbers such as IV (4), II (2), etc.
The text was updated successfully, but these errors were encountered:
found this on the web for roman numbers:
def roman_to_int(s): rom_val = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000} int_val = 0 for i in range(len(s)): if i > 0 and rom_val[s[i]] > rom_val[s[i - 1]]: int_val += rom_val[s[i]] - 2 * rom_val[s[i - 1]] else: int_val += rom_val[s[i]] return int_val
Edit: The function seems to work but gives wrong output instead of error when given a wrong roman number.
Sorry, something went wrong.
No branches or pull requests
Support numbers such as IV (4), II (2), etc.
The text was updated successfully, but these errors were encountered: