I need a program that will solve a bunch of algebra equations from a list and output all the answers ex:




I am using windows 7

1 Answer 1


First point - your example is not algebra nor equations - it is arithmetical operations. The difference algebra: x + 3 = 5 => x=? while arithmetic 4 + 4 = ?

Assuming that your file really is a set of lines like your in example, i.e. simple arithmetic statements with spaces between and no other spaces:

  1. install python for windows, it is free, accepting the option to add it to the path
  2. Open a command prompt and cd to the directory as your file is in
  3. type python
  4. type:
for line in open('sums.txt'):
       for item in line.split(' '):
           if len(item) > 1:
               print(item, '=', eval(item))


The above assumes that you called your list sums.txt and will print out your results. With a little bit of reading you can set up a script to do this for you and add the use of trigonometric functions such as sin, cos, tan, etc. Note that basic the operators you can have in your text file, with python3, are:

  • Add: +
  • Subtract: -
  • Multiply: *
  • Divide: \
  • Floor: \\
  • Modulo: %
  • Brackets: ()
  • It was just an example I have algebra but can you close this because I don't need it anymore.
    – Noah
    Commented Sep 4, 2016 at 11:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.