Balancing Chemical Equations using Python

The answer is a bold yes, and there are a few ways that we can approach the problem. Mine might not be the fastest, but it is accurate for all chemical equations that do not include polyatomic decomposition. To elaborate on that caveat, a polyatomic on one side of the equation breaks apart into separate parts — this algorithm can only handle polyatomic ions that stay (the same) polyatomic ions on the other side of the equation.

Here’s my program working on three increasingly complex balancing equations (no polyatomic decomposition though!)

Click Here