- eval() is a special type of function in python, which execute itself within the program.
-It is used to solve the mathematical expression(equations)
Syntax-
eval(expression,global=0,local=0)
-Here global and local are optional part of the eval.
Example-
expr="x**2+x*2+6"
and x is 2
then eval(expr) will return 14
program-
y='x**2+x*1+1'
x=3
z=eval(y)
print(z)
y='x**3+x*1+1'
x=2
z=eval(y)
print(z)
y='x*1+1'
x=5
z=eval(y)
print(z)
13
11
6