roman_numerals_webservice.roman_numerals package¶
Submodules¶
roman_numerals_webservice.roman_numerals.arabic_to_roman module¶
-
class
roman_numerals_webservice.roman_numerals.arabic_to_roman.ArabicToRoman[source]¶ Bases:
object-
static
convert(arabic: int) → str[source]¶ Convert an Arabic numeral to a Roman numeral
To convert Arabic numerals we chose the algorithm from Paul M. Winkler presented in
"Python Cookbook" by David Ascher, Alex Martelli ISBN: 0596001673. since it is arguably the most readable algorithm.Parameters: arabic (int) – Arabic numeral represented as integer. The number must be be in
[1,...,3999]Raises: TypeError– arabic does not satisfyisinstance(arabic, numbers.Integral)must be true.ValueError– arabic does not satisfy1 <= v <= 3999
Returns: string encoding the input as Roman numeral
Return type: str
-
static
-
roman_numerals_webservice.roman_numerals.arabic_to_roman.arabic_to_roman(arabic: int) → str[source]¶ Convert an Arabic numeral to a Roman numeral
Shorthand for
ArabicToRoman.convert(), seeArabicToRoman.convert()for full documentation.Parameters: arabic – Arabic numeral represented as integer.
Raises: TypeError– arabic does not satisfyisinstance(arabic, numbers.Integral)must be true.ValueError– arabic does not satisfy1 <= v <= 3999
Returns: string encoding the input as Roman numeral
Return type: str
roman_numerals_webservice.roman_numerals.roman_to_arabic module¶
-
class
roman_numerals_webservice.roman_numerals.roman_to_arabic.RomanToArabic[source]¶ Bases:
object-
static
convert(roman: str) → int[source]¶ Convert a Roman numeral to an Arabic Numeral.
To convert Arabic numerals we chose the algorithm from Paul M. Winkler presented in
"Python Cookbook" by David Ascher, Alex Martelli ISBN: 0596001673. since it is arguably the most readable algorithm.Parameters: roman (str) – Roman numeral represented as string.
Raises: TypeError– roman is not a stringValueError– roman is not a valid Roman numeral
Returns: int encoding the input as Arabic numeral
Return type: int
-
static
-
roman_numerals_webservice.roman_numerals.roman_to_arabic.roman_to_arabic(arabic: int) → str[source]¶ Convert a Roman numeral to an Arabic Numeral.
Shorthand forRomanToArabic.convert(), seeRomanToArabic.convert()for full documentation.Parameters: roman (str) – Roman numeral represented as string.
Raises: TypeError– roman is not a stringValueError– roman is not a valid Roman numeral
Returns: int encoding the input as Arabic numeral
Return type: int