This is now my current code after what user2486 said.
def romanMap(): map=((\"M\", 1000),(\"CM\", 900),(\"D\", 500),(\"CD\", 400),(\"C\", 100),(\"XC\"
def romanToInt(self, s: str) -> int: roman_dict = {'I':1, 'V':5, 'X':10, 'L':50, 'C':100, 'D':500, 'M':1000} int_equ = 0 for i in range(len(s)): if i > 0 and roman_dict[s[i]] > roman_dict[s[i-1]]: int_equ += roman_dict[s[i]] - 2*roman_dict[s[i-1]] else: int_equ += roman_dict[s[i]] return int_equ