File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,9 +40,9 @@ class InvalidRomanNumeralError(RomanError): pass
4040def toRoman (n ):
4141 """convert integer to Roman numeral"""
4242 if not (0 < n < 5000 ):
43- raise OutOfRangeError , "number out of range (must be 1..4999)"
44- if int (n ) <> n :
45- raise NotIntegerError , "decimals can not be converted"
43+ raise OutOfRangeError ( "number out of range (must be 1..4999)" )
44+ if int (n ) != n :
45+ raise NotIntegerError ( "decimals can not be converted" )
4646
4747 result = ""
4848 for numeral , integer in romanNumeralMap :
@@ -67,9 +67,9 @@ def toRoman(n):
6767def fromRoman (s ):
6868 """convert Roman numeral to integer"""
6969 if not s :
70- raise InvalidRomanNumeralError , 'Input can not be blank'
70+ raise InvalidRomanNumeralError ( 'Input can not be blank' )
7171 if not romanNumeralPattern .search (s ):
72- raise InvalidRomanNumeralError , 'Invalid Roman numeral: %s' % s
72+ raise InvalidRomanNumeralError ( 'Invalid Roman numeral: %s' % s )
7373
7474 result = 0
7575 index = 0
You can’t perform that action at this time.
0 commit comments