Solve three variable equation in python by R4R Team

-Here our task to find the value of the equation of three variable.

Example-
Equation is f(x,y,z)='x+y+z+4'
then at x=1,y=2 and z=3, f(1,2,3)=10


program-

#take input of equation and variables value
print("Enter equation of three variable in the form of x,y and z")
equation=input()
print("Enter value of x")
x=int(input())
print("Enter value of y")
y=int(input())
print("Enter value of z")
z=int(input())

#solve equation by eval
ans=eval(equation)
print("Value of equation is",ans)


output-

Enter equation of three variable in the form of x,y and z
x+2*y+z*3+7
Enter value of x
1
Enter value of y
1
Enter value of z
1
Value of equation is 13


-In this program, we take of equation of three variable and value of the variables then using eval() function we find the value of the equation.




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!