[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2023-10-11 02:22:30 +00:00
parent 0e5eb46ddd
commit 588ab7bee4

View File

@ -1,8 +1,20 @@
ROMAN_NUMERALS = {
1000: "M", 900: "CM", 500: "D", 400: "CD", 100: "C",
90: "XC", 50: "L", 40: "XL", 10: "X", 9: "IX", 5: "V", 4: "IV", 1: "I"
1000: "M",
900: "CM",
500: "D",
400: "CD",
100: "C",
90: "XC",
50: "L",
40: "XL",
10: "X",
9: "IX",
5: "V",
4: "IV",
1: "I",
}
def roman_to_int(roman):
result = 0
i = 0
@ -15,6 +27,7 @@ def roman_to_int(roman):
i += 1
return result
def int_to_roman(number):
result = ""
for value, numeral in ROMAN_NUMERALS.items():
@ -23,6 +36,8 @@ def int_to_roman(number):
number -= value
return result
if __name__ == "__main__":
import doctest
doctest.testmod()