Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
Washing soda is sodium carbonate, Na2CO3. What counts does the formula reader give, and what is the molar mass? Use Na , C and O .
Molar mass the sum of atomic mass times count for every element. In Python: sum(atomic[el] * n for el, n in counts.items()). A formula is read into symbols and counts with re.findall(r"([A-Z][a-z]?)(\d*)", formula), after brackets are opened. Mass percent .
Have you tried it?
Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, go through the solution one step at a time, and check each step against your own.
Step 1. Counts. count_atoms("Na2CO3") gives {'Na': 2, 'C': 1, 'O': 3}.
Step 2. Sum. .
Answer: g/mol.
Log in to join the discussion.
Loading…