Suppose I have a program which asks me to input an equation to calculate something numerically.
I input 2*x+y
as a string and it instantiates variable x
and assigns numerical value to it then it instantiates variable y
and assigns a value to it.
The result is calculated based on the equation that I input (Here it is 2*x+y
)
x = 2
y = 3
result = 2*x + y
print(result)
I want to enter the equation symbolically and carry the rest of the equation numerically.
What is the best way to do so? (Looking for best practices to implement this idea so the program is able to scale for further development)