You will finish a program that finds the shape of a molecule or ion from the valence electrons of the central atom, the atoms bonded to it and the charge.
The idea. The central atom gives one electron to each hydrogen or halogen atom, and two to each oxygen atom that has a double bond. The electrons that are left form lone pairs, and a negative charge adds electrons. The steric number and the number of lone pairs give the shape.
Your tasks.
lone_pairs(valence, ligands, charge) so that it returns the number of lone pairs.steric_number(valence, ligands, charge) so that it returns the number of bonded atoms plus the lone pairs.shape(valence, ligands, charge) so that it returns the name from the table SHAPES.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…