Problem: Balancing Chemical Equations, Part II

Learn how to balance chemical equations using linear programming.

Parsing chemical equations

We’ll use the chemparse library to parse the reactants and products. The parse function parses the equations. The function will expect an input similar to the one below:

Zn+HClZnCl2+H2Zn + HCl \rightarrow ZnCl_{2} + H_{2}

We can split using -> to get the left-hand side and the right-hand side.

Get hands-on with 1200+ tech skills courses.