You will write three functions that check a nuclear equation.
The idea. In a nuclear equation the nucleon numbers add up to the same total on both sides. So do the proton numbers. Each particle is written (A, Z). A neutron is (1, 0).
Your tasks.
totals, return the pair (sum of the A numbers, sum of the Z numbers) for a list of particles.is_balanced, return True when the two sides have the same totals.missing_particle, return the (A, Z) of the one particle missing from the right-hand side.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…