项目作者: rkoeninger

项目描述 :
Roman numeral converter
高级语言: Python
项目地址: git://github.com/rkoeninger/roman_numerals.git
创建时间: 2017-01-27T21:58:40Z
项目社区:https://github.com/rkoeninger/roman_numerals

开源协议:

下载


Roman Numerals

Simple roman numeral parser function in Python.

I had to do one of these in pseudo-code as an interview exercise and decided to write it up in Python and throw it on here.

It has some limitations:

  • It only supports the characters I, V, X, L, C, D and M.
  • Instances of subtractive notation only support a single prefix character.
  • However, subtractive pairs can contain any two characters so long as the first is less than the first. So roman_value('IM') == 999, which I don’t think is typical.