You will write functions that sort an amine by the groups on its nitrogen atom. The groups are given as a list such as ["CH3", "H", "H"]. A hydrogen atom is written as "H".
The idea. The class of an amine is the number of carbon groups on the nitrogen. Hydrogen atoms do not count. An amine is aromatic only when the nitrogen is joined straight to a benzene ring, written as the group "C6H5".
Your tasks.
carbon_groups(groups) so that it returns how many of the three positions hold a carbon group.classify(groups) so that it returns "primary", "secondary" or "tertiary".is_aromatic(groups) so that it returns True when one of the groups is exactly "C6H5".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…