we are solving it for the question who owns zebra with the help of python let us import the necessary packagesfrom kanren import from kanren core import lall import time nowwe need to define two functions left(and next(to check whose house is left or next to who' housedef left(qplist)return membero(( , )zip(listlist[ :])def next(qplist)return conde([left(qplist)][left(pqlist)]nowwe will declare variable house as followshouses var(we need to define the rules with the help of lall package as follows there are housesrules_zebraproblem lall(eq(var()var()var()var()var())houses)(membero,('englishman'var()var()var()'red')houses)(membero,('swede'var()var()'dog'var())houses)(membero,('dane'var()'tea'var()var())houses)(left,(var()var()var()var()'green')(var()var()var()var()'white')houses)(membero,(var()var()'coffee'var()'green')houses)(membero,(var()'pall mall'var()'birds'var())houses)(membero,(var()'dunhill'var()var()'yellow')houses)(eq,(var()var()(var()var()'milk'var()var())var()var())houses)(eq,(('norwegian'var()var()var()var())var()var()var()var())houses)(next,(var()'blend'var()var()var())