Answer To: Problem 1 Please write a logic inferencing program using Python which can handle family relationship...
Sudipta answered on Oct 14 2021
{
"cells": [
{
"cell_type": "code",
"execution_count": 63,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"123 Edward's son is David.\n",
"John's daughter is Mary. Martha's husband is John.\n",
"Mary's uncle Catherine.\n",
"Catherine's mother?\n",
"David's brother is John.\n",
"Edward's wife is Jennifer.\n",
"Who is John's father?\n",
"ERROR\n"
]
}
],
"source": [
"import csv\n",
"import pandas as pd\n",
"data=[i.strip() for i in open('t69.dat').readlines()]\n",
"for i in data:\n",
" print(i)\n",
"print(\"ERROR\") \n"
]
},
{
"cell_type": "code",
"execution_count": 64,
"metadata": {
"collapsed": false,
"scrolled": true
},
...