mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-02-23 01:28:26 +00:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
6bff12142e
commit
dd13fe23b0
|
@ -25,6 +25,8 @@ ROMAN = [
|
|||
(4, "IV"),
|
||||
(1, "I"),
|
||||
]
|
||||
|
||||
|
||||
def roman_to_int(roman: str) -> int:
|
||||
"""
|
||||
Convert a Roman numeral to an integer, supporting Vinculum notation
|
||||
|
@ -52,6 +54,8 @@ def roman_to_int(roman: str) -> int:
|
|||
total += vals[roman[i]]
|
||||
i += 1
|
||||
return total
|
||||
|
||||
|
||||
def int_to_roman(number: int) -> str:
|
||||
"""
|
||||
Convert an integer to a Roman numeral, supporting Vinculum notation
|
||||
|
@ -75,6 +79,8 @@ def int_to_roman(number: int) -> str:
|
|||
break
|
||||
return "".join(result)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import doctest
|
||||
|
||||
doctest.testmod()
|
||||
|
|
Loading…
Reference in New Issue
Block a user