O'Reilly logo

Artificial Intelligence with Python by Prateek Joshi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Parsing a family tree

Now that we are more familiar with logic programming, let's use it to solve an interesting problem. Consider the following family tree:

Parsing a family tree

John and Megan have three sons - William, David, and Adam. The wives of William, David, and Adam are Emma, Olivia, and Lily respectively. William and Emma have two children - Chris and Stephanie. David and Olivia have five children - Wayne, Tiffany, Julie, Neil, and Peter. Adam and Lily have one child - Sophia. Based on these facts, we can create a program that can tell us the name of Wayne's grandfather or  Sophia's uncles are. Even though we have not explicitly specified anything about the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required