The Roman numeral system is an ancient way of representing numbers. The base symbols are I (1), V (5), X (10), L (50), C (100), D (500) and M (1000).
Questions tagged [roman-numerals]
273 questions
2
votes
1 answer
Stop counting if a character can't be found in map
I've got an assignment in which I've to create a roman numeral to integer converter. As my code stands, I've just used a map to relate characters to integer values, which are added to a sum, accounting for values like IV etc. For strings that do not…

That_Guy989
- 33
- 3
2
votes
6 answers
Python - Convert a roman numeral to an integer
I've tried the following Python 3 code that transform from Roman to Integer.
The code is working fine at a glance. But there are certain problem happened when I input X, V or related to X and V value.
For example: when I try V the code is not…

code_program
- 33
- 1
- 6
2
votes
2 answers
How can I break numbers into their digit values?
As part of a Roman numerals converter algorithm, I would like to break a given number into their digit values. What I precisely want to do is as follows:
1984 = 1000+900+80+4
It would be better to let you know where I will use the outcome. I will…

Mehmet Eyüpoğlu
- 169
- 11
2
votes
3 answers
Roman Numeral to Number Conversion in Javascript/HTML
I am new to javascript and am wanting to make a html file that displays the number of days until super bowl "LIV", the current time, and an input for the user to convert a roman numeral into a number. My code is below and as it is now, the countdown…

LukeThomas
- 75
- 1
- 1
- 6
2
votes
3 answers
Integer to Roman while loop explanation-Python
I am trying to understand the while loop and sorted call in the program to convert a number to Roman numerals below.
numerals = { 1 : "I", 4 : "IV", 5 : "V", 9 : "IX", 10 : "X", 40 : "XL",
50 : "L", 90 : "XC", 100 : "C", 400 : "CD",…

Sheikh Rahman
- 895
- 3
- 14
- 29
2
votes
1 answer
ReactJS how to create list "ol" or "ul" with roman number format
I'm creating JSX element which contains list, and I need to use the roman format, but nothing work
type='i' not defined
data-type='i' not working
list-style-type="upper-roman" not working
const howToTest: JSX.Element = (
- 464
- 1
- 4
- 13

Ahmed Mohamed
2
votes
1 answer
Roman numerals to numbers in string
I have this string:
$string = 'Hello IV WorldX';
And I want to replace all roman numerals to integers.
I have the following function to convert roman to integer:
function roman2number($roman){
$conv = array(
array("letter" => 'I',…

Henrik Petterson
- 6,862
- 20
- 71
- 155
2
votes
3 answers
My total is not updating in my loop
I'm new to java and i am confused as to why the variable total is not updating. When I print it it just prints the initial number of 0. Also the method value returns numbers based on the roman character. I left out the class line but that…

Bugaboo
- 21
- 2
2
votes
1 answer
PostgreSQL: How to return roman date with single space delimitation elegantly?
If I use the standard way to receive a date with roman-numeric months ...
SELECT to_char(DATE '2000 12 05', 'DD RM YYYY')
PostgreSQL returns multi-spaced (1 to 4) delimited dates:
"05 XII 2000"
"02 VIII 1976"
"02 V 1976"
I notice that RM…

Bastiaan Wakkie
- 303
- 3
- 9
2
votes
0 answers
Python NLTK collocation for roman numerals
As there is a collocation for numbers in nltk such as ('RS', '##number##')
I'm wondering if there is such a specifier for Roman numerals which I want to use for something like this: ('volume', '##roman number##')
If there is no way to do such a…

eightnoteight
- 234
- 2
- 11
2
votes
3 answers
Roman to Int converts incorrectly in some cases
My function looks like this:
let romanToInt = romanNumber => {
if(typeof romanNumber !== 'string') throw new TypeError('Argument must be of type String');
const values = { 'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000 };
…

Nilzone-
- 2,766
- 6
- 35
- 71
2
votes
4 answers
Python 3.5.2 Roman Numeral Quiz
So I am doing this assignment for school. I have to create a quiz like game that will prompt a user to add roman numerals together and input their answer. It will then check the user's answer with the correct answer and tell the user if they got it…

Brock
- 125
- 13
2
votes
1 answer
replacing Roman Numerals I-XXX with RegEx
Removing chapter headings in Roman numerals (no more that 30, which are followed by a space and then a colon) I use:
str = str.replace(/^((X{0,3})(I{0,1})(V{0,1})(X{0,1})(I){0,3}:\s+?)$/gim, "");
Only it seems to be super-slow. Where am I going…

Ghoul Fool
- 6,249
- 10
- 67
- 125
2
votes
2 answers
Regular expression for matching a variety of types of numbered lists
I'd like to create a (PCRE) regular expression to match all commonly used numbered lists, and I'd like to share my thoughts and gather input on way to do this.
I've defined 'lists' as the set of canonical Anglo-Saxon conventions, i.e.
Numbers
1 2…

Brian M. Hunt
- 81,008
- 74
- 230
- 343
2
votes
3 answers
Java -- Read from std input, one char at a time
I'm having trouble determining the best way to read some input in for a java program. It needs to read in the individual characters of a roman numeral, and then perform some operation on it.
There are, however, several catches. The input must be…

Raven Dreamer
- 6,940
- 13
- 64
- 101