In this program I have the user enter an equation and display it back to them.
The problem I'm having is that when I call the function that asks for the equation again I get a TypeError. I have know why I keep getting this error and have tried multiple ways to try and fix it. help?
import parser
def eq():
global eq
global eq_parsed
while True:
eq = input('f(x) = ')
try:
eq_parsed = parser.expr(eq).compile()
x=0
eval(eq_parsed)
break
except:
print("invalid equation")
print ("Your equation: f(x)=", eq)
mark=True
return (mark)
T=True
mark=False
while T==True:
if mark==False:
n=input("\nStart? (y/n): ")
elif mark==True:
n=input("\nStart Again? (y/n): ")
#----------------------------------------
if n=='y':
mark = eq()
elif n=='n':
break
else:
print("Invalid Input*")