Awesome-Python-Scripts/Algebra-Solver/Algebra-Solver.py
2018-10-04 22:57:34 +07:00

16 lines
265 B
Python

#!/usr/bin/python3
from sympy import *
import sys
def solver(x):
sympy_eq = sympify("Eq(" + x.replace("=", ",") + ")")
result = solve(sympy_eq)
return result[0]
def main(x):
X = solver(x)
print("X = " + str(X))
if __name__ == "__main__":
main(sys.argv[1])