hi i am working on a challenging assignment where i have a list of different animals in an ecosystem and i have to show the relation ships
the outpu requires to"
# List of all species (in alphabetical order)
# List of species at the top of the food chain. (in alphabetical order)
# For each of the species on the top of the food chain, show the species upon which this species is dependent (directly or indirectly)
# Identify the species upon which this ecosystem is most d

and the list of species is as follows:

Fragrant Skunk eats Yowly Mouse
Yowly Mouse eats Spiney Watercress
Frothy Marmot eats Yowly Mouse

i am soo desperate if some can help me i would greatly appreciate the assignment is due in 2 days

Actually quite an interesting assignment.

One way to solve this is to assign a rank number to each species. Start out with the same rank for each and then loop though a number of times (let's say 2 times the length of the species list) using your rules.

Transform your rules into if conditionals. For instance ...

``````# if mouse eats nut, increase the rank of
# mouse at least by one above the nut
if mouse_rank <= nut_rank:
mouse_rank += 1``````

... and so on for all your rules.

Then create a list of (rank, 'species') tuples and sort the list to bring the highest ranks in front. Once you have those data you can do all the rest, picking the right elements by index etc.