Мельников Алексей, Севастополь EvalFormulae 7811
Stanislav EvalFormulae 8435
f1def evalform(formula, *args):f1def evalform(formula, *args):
2    var = ''2    var = ''
3    vars = set()3    vars = set()
4    for s in formula:4    for s in formula:
5        if s.isalpha():5        if s.isalpha():
6            var += s6            var += s
tt7        else:
7        elif var:8            if var:
8            vars.add(var)9                vars.add(var)
9            var = ''10            var = ''
10    if var:11    if var:
11        vars.add(var)12        vars.add(var)
12    vars = list(vars)13    vars = list(vars)
13    vars.sort()14    vars.sort()
14    vars_dict = {k: v for k, v in zip(vars, args)}15    vars_dict = {k: v for k, v in zip(vars, args)}
15    return eval(formula, vars_dict, None)16    return eval(formula, vars_dict, None)
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op