I'm a student. Few days ago I think that I can make a python program to solve math formula and after few minute coding I ended up like this.
class Formula:
def __init__(self,formula):
self.formula=formula
def formulate(self,values):
vals=values.split(";")
for i in vals:
reval=i.split('=')
self.formula=self.formula.replace(reval[0],reval[1])
return eval(self.formula)
sum=Formula('(a+b)/c')
print(sum.formulate('a=2;b=56;c=5'))
How can I make this program to perform better? Can I make this program to solve problem step-by-step?How?