Each element in the dictionary is given as a list of its isotopes, with the mass number and the percentage of the atoms. You will make the program find the average atomic mass of each, test that the percentages add up to , and find the element whose average is furthest from a whole number.
The idea. The average is weighted: multiply each mass number by its percentage, add them up, and divide by . The more common isotope pulls the average towards itself.
Your tasks.
average, return the weighted average atomic mass.adds_up, return True when the percentages add up to .furthest, the name of the element whose average is furthest from the nearest whole number.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…