You will write three small functions that sort the 16 boxes of AaBb × AaBb into phenotype classes for a rule of gene interaction.
The idea. A rule is a function that gets two true or false values, "the plant has A" and "the plant has B", and returns the name of the phenotype. Counting the boxes for each name gives the ratio.
Your tasks.
f2_counts. It takes a rule and gives a dictionary of phenotype names and the number of boxes of the 16.ratio_text. It takes the dictionary and gives the ratio in the form "9 : 3 : 4", from the largest class to the smallest.labrador. It is the rule for the coat of a Labrador: "yellow" if the dog has no A, otherwise "black" if it has B, and "brown" if not.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…