You will write three functions for the displacement of halogens. One decides whether a halogen displaces another. One says what you would see. One finds the moles of halogen made.
The idea. The order of reactivity is chlorine, bromine, iodine, with chlorine the most reactive. A halogen displaces another only if it is higher in the list. Displaced bromine makes the solution orange and displaced iodine makes it brown. In two moles of halide make one mole of halogen.
Your tasks.
displaces(halogen, halide). Both arguments are the names of halogens, for example "chlorine" and "bromine" for chlorine water and potassium bromide.observation(halogen, halide). It returns the colour from the dictionary colour if the halogen displaces the other, and "no reaction" if not.moles_made(mol_halide). It returns the moles of halogen molecules that form.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…