<qiyuangong>013_Roman_to_Integer_1.py
def romanToInt( s):
    roman = {'I': 1, 'V': 5, 'X': 10,
             'L': 50, 'C': 100, 'D': 500, 'M': 1000}
    result = 0
    last = s[-1]
    for t in reversed(s):
        if t == 'C' and last in ['D', 'M']:
            result -= roman[t]
        elif t == 'X' and last in ['L', 'C']:
            result -= roman[t]
        elif t == 'I' and last in ['V', 'X']:
            result -= roman[t]
        else:
            result += roman[t]
        last = t
    return result
def sample_funcname ( var_0 ) :
    var_15 = { 'I' : 1 , 'V' : 5 , 'X' : 10 , 'L' : 50 , 'C' : 100 , 'D' : 500 , 'M' : 1000 }
    var_17 = 0
    var_18 = var_0 [ - 1 ]
    for var_20 in reversed ( var_0 ) :
        if var_20 == 'C' and var_18 in [ 'D' , 'M' ] :
            var_17 -= var_15 [ var_20 ]
        elif var_20 == 'X' and var_18 in [ 'L' , 'C' ] :
            var_17 -= var_15 [ var_20 ]
        elif var_20 == 'I' and var_18 in [ 'V' , 'X' ] :
            var_17 -= var_15 [ var_20 ]
        else :
            var_17 += var_15 [ var_20 ]
        var_18 = var_20
    return var_17
