You will write three functions that name an anion from what is seen. The observations are stored in a dictionary with three keys. The key "dilute" holds the gas with dilute sulphuric acid ("CO2", "H2S", "SO2", "NO2", "vinegar") or None. The key "conc" holds the vapour with concentrated sulphuric acid ("HCl", "brown", "violet") or None. The key "bacl2_in_hcl" is True when barium chloride gives a white precipitate that stays in dilute hydrochloric acid.
The idea. First try the dilute acid test. If it gives nothing, try the concentrated acid test. Sulphate is last, because it gives no gas.
Your tasks.
dilute_acid(gas). It returns the anion from the table DILUTE, or None.conc_acid(vapour). It returns the anion from the table CONC, or None.anion(obs). It tries the dilute acid, then the concentrated acid, then the sulphate test, and returns "unknown" if nothing fits.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…