You will write functions that work out facts about an addition polymer from the atoms of its monomer. A formula is a dictionary of atom counts, such as {"C": 2, "H": 3, "Cl": 1} for chloroethene.
The idea. An addition polymer keeps every atom of its monomer. So the repeat unit has the monomer's molar mass, and each element has the same percentage in both.
Your tasks.
molar_mass(formula). It adds up the atomic masses in MASS times the counts.percent(formula, element). It returns the mass percentage of one element.degree(mn, formula). It returns the degree of polymerisation, mn divided by the repeat unit mass, rounded to a whole number.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…