You will write four functions for oxidation numbers. One finds the oxidation number of an unknown element. One writes the Roman numeral. One says whether a change is oxidation or reduction. One says whether a reaction is redox.
The idea. The oxidation numbers add up to the charge of the species. So the number for the unknown element is . An increase in oxidation number is oxidation, and a decrease is reduction. If no element changes its number, the reaction is not redox.
Your tasks.
unknown_number(others, atoms, charge). others is a list of pairs (oxidation number, how many atoms).roman(n) for the numbers 1 to 7.change(before, after) so that it returns "oxidised", "reduced" or "no change".is_redox(pairs). pairs is a list of (before, after) for each element. It returns True if any of them changes.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…