You will teach the computer to read a molecular formula such as C2H6O and to find a percentage yield.
The idea. A formula is a list of element symbols, each followed by a count (no count means 1). The molar mass is the sum of count times atomic mass.
Your tasks.
molar_mass(formula). The helper parse already turns "C2H6O" into {"C": 2, "H": 6, "O": 1}.theoretical_mass(start_mass, start, product): one mole of product from each mole of start.percent_yield(actual, start_mass, start, product).Run your code once to unlock the worked solution.
Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…