You will write the function that finds the trophic levels a species can occupy, and a function that finds the longest chain.
The idea. The producer is at level 1. An animal is one level above each of its foods, so its set of levels is the levels of its foods, each plus one.
Your tasks.
levels. It returns the set of the trophic levels of a species.longest. It returns the highest level that any species of the web can reach.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…
With Standard, you also open 12 more problems, 2 Python labs and 1 extra course. Everything you have used here stays free, always.