I try to define the key of a dictionary as symbol and then I make an expression with those keys. but in the def, there is always show error that said symbol of the key is not defined. but I do debug and it said those symbol of the key is already there.
import sympy as sm
def try_sym(dic):
for k, v in dic.items():
exec(k+"=sm.Symbol(k)")
f = sm.Symbol("f")
#a=sm.Symbol("a")
f = a+b
return f
dic = {"a":1, "b":10}
f =sm.Symbol("f")
f=try_sym(dic)
print(f)