Every covalent bond uses one unit of valency from each of its two atoms. You will make the program add up the valencies of a molecule, turn them into a number of bonds, and spot a formula that cannot exist.
The idea. Bonds (sum of the valencies) , counting a double bond as two. If the sum is odd, the units cannot pair up, and no such molecule exists.
Your tasks.
units, return the sum of the valencies of all the atoms.bonds, return the number of bonds, or None if the sum is odd.propanol_bonds, the bonds in propanol, .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…