Skip to content

Commit

Permalink
Revert "[Major Fix] -- rom2int fixed"
Browse files Browse the repository at this point in the history
All is fine
  • Loading branch information
Florian-DELRIEU committed May 4, 2020
1 parent f4669f3 commit 16c8378
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions Utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,10 @@ def rom2int(roman=str()):
if roman.find(el) is not -1: assert False, "Error roman number badly written"

while roman is not "":
if "CM" in roman:
if "M" in roman:
number += 1000
roman = roman.replace("M","",1)
elif "CM" in roman:
number += 900
roman = roman.replace("CM","",1)
elif "CD" in roman:
Expand All @@ -145,9 +148,6 @@ def rom2int(roman=str()):
elif "IV" in roman:
number += 4
roman = roman.replace("IV","",1)
elif "M" in roman:
number += 1000
roman = roman.replace("M","",1)
elif "D" in roman:
number += 500
roman = roman.replace("D","",1)
Expand All @@ -166,6 +166,4 @@ def rom2int(roman=str()):
elif "I" in roman:
number += 1
roman = roman.replace("I","",1)
return number

rom2int("CM")
return number

0 comments on commit 16c8378

Please sign in to comment.