<doocs>0241.Different Ways to Add Parentheses_1.py
def dfs(exp):
    if exp.isdigit():
        return [int(exp)]
    ans = []
    for i, c in enumerate(exp):
        if c in '-+*':
            left, right = dfs(exp[:i]), dfs(exp[i + 1 :])
            for a in left:
                for b in right:
                    if c == '-':
                        ans.append(a - b)
                    elif c == '+':
                        ans.append(a + b)
                    else:
                        ans.append(a * b)
    return ans
def sample_funcname ( var_1 ) :
    if var_1.isdigit ( ) :
        return [ int ( var_1 ) ]
    var_4 = [ ]
    for var_6 , var_7 in enumerate ( var_1 ) :
        if var_7 in '-+*' :
            var_9 , var_11 = var_0 ( var_1 [ : var_6 ] ) , var_0 ( var_1 [ var_6 + 1 : ] )
            for var_12 in var_9 :
                for var_13 in var_11 :
                    if var_7 == '-' :
                        var_4.append ( var_12 - var_13 )
                    elif var_7 == '+' :
                        var_4.append ( var_12 + var_13 )
                    else :
                        var_4.append ( var_12 * var_13 )
    return var_4
