A key to five garden plants asks one question at a time, and a "yes" ends the search. You will make the key run, test it on seven plants, and find the plants that it names wrongly. Then the program draws how many it gets right.
The idea. A key works only for the organisms that it was built for. A plant outside the key still gets a name, but the name may be wrong.
Your tasks.
identify, go down the key and return the name for the first trait that the plant has; if none, return last_choice.results to a dictionary of each plant and the name the key gives.wrong to the plants that the key names wrongly, in the order of the dictionary.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…