You will write a function that names an interaction from the effect on each species, and use it on a table of pairs.
The idea. Each species is helped (1), not affected (0) or harmed (-1). Two helped is mutualism, two harmed is competition, one of each is predation or parasitism, a helped and a zero is commensalism, and a harmed and a zero is amensalism.
Your tasks.
name. It gives the name of the interaction. Use "none" for two zeros.count_harmed. It counts the pairs in the list in which at least one species is harmed.count_named. It counts the pairs that have a given name.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…