Try finding your ancestors and offspring with code.
Create a function that takes a number x and a character y ("m" for male, "f" for female), and returns the name of an ancestor (m/f) or descendant (m/f).
0. In the case of 0 (male or female), return "me!".generation(2, "f") ➞ "granddaughter"
generation(-3, "m") ➞ "great grandfather"
generation(1, "f") ➞ "daughter"
| Generation | Male | Female |
|---|---|---|
| -3 | great grandfather | great grandmother |
| -2 | grandfather | grandmother |
| -1 | father | mother |
| 0 | me! | me! |
| 1 | son | daughter |
| 2 | grandson | granddaughter |
| 3 | great grandson | great granddaughter |