Please consider offering answers and suggestions to help other students!
And if you fix a problem by following a suggestion here,
it would be great if other interested students could see a short
"Great, fixed it!" followup message.
There is an explanation under the function in genealogy.py that explains how to calculate it.
If you draw a diagram of the test sample genealogy, you can see who is related to who and find their closest shared ancestor. Then, from this shared ancestor, you count how many generations from the ancestor starting at 0. So child is 0, grandchild is 1, great-grandchild is 2, etc. Do this for both the relatives so you have the order for each of them. Then the degree is whichever of these is greater. So order 1 and 2 would be degree 2. The removal is the difference in the orders, so for order 1 and 2, removal is 1.
If you go through the expected answers in the tests, you should find the result is the same as what you would expect.
I am a bit confused for the ones where the shared ancestor is one of the "cousins", such as "B" and "D" or "B" and "J". It looks like if you make the shared ancestor order -1, then the child 0, etc, then "B" and "F" is order 1 (greater of -1 and 1) and removal is 2 (difference of -1 and 1 as an absolute value).