You will write three functions for judging an ore. A mineral is a dictionary of element symbols and counts, such as {"Fe": 2, "O": 3}. A table MASSES gives the atomic masses.
The idea. The molar mass is the sum of count times atomic mass. The metal fraction is the mass of the metal in one formula unit divided by the molar mass.
Your tasks.
molar_mass(formula).metal_fraction(formula, metal).ore_for_metal(tonnes_metal, formula, metal, share). It returns the tonnes of ore that hold that much metal, when the ore holds the mineral at the fraction share.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…