From 16c837869da3d28b1dd66ed819697aa6d2cb7d51 Mon Sep 17 00:00:00 2001 From: floriandelrieu Date: Mon, 4 May 2020 06:32:54 +0200 Subject: [PATCH] Revert "[Major Fix] -- rom2int fixed" All is fine --- Utilities.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Utilities.py b/Utilities.py index d4c8848..1a2033c 100644 --- a/Utilities.py +++ b/Utilities.py @@ -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: @@ -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) @@ -166,6 +166,4 @@ def rom2int(roman=str()): elif "I" in roman: number += 1 roman = roman.replace("I","",1) - return number - -rom2int("CM") \ No newline at end of file + return number \ No newline at end of file