A wood has dark moths and pale moths. Birds eat more of one kind than the other. You will write the three steps that follow the moths from generation to generation.
The idea. Each kind keeps only the survivors, and the population is then scaled back to its old size. The kind that survives better becomes more common.
Your tasks.
survivors. It gives how many moths of one kind survive.next_generation. It gives the new numbers of dark and pale moths, with the total kept the same.generations_to_half. It counts the generations until the dark moths outnumber the pale moths.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…