0
Roman numeral logic correction
I've created a roman numeral to decimal converter, in which it takes the users input as roman numerals, which is then iterated through and assigned to it's equivalent dictionary value. but when trying to add values like XII(12) or III(3), i get values that are often 1 number higher than they are supposed to be, like 13 or 4. what makes this harder is the consistency at which this happens - only for repeat values. what am i doing wrong? source code: https://code.sololearn.com/cawSz1yqt8o3
1 ответ
+ 1
hi,
first, amend you rNumeral to include 'IV, IX, ...CM'
then iterate from highest , eg MCMIX will be 1000+900+9