+ 1
Then you should write a program that searches for example sin in input and replaces it with math.sin. And the same way for power, ^ should be replaced with **. Then you can use eval.
+ 1
Use function eval.
>>>a='x+1'
>>>x=3
>>>eval(a)
>>>4
0
You are welcome :)