this is the facts I entered in the knowledge base and average takes a list and returns the result but when i pose the query
“average([],X).”
it returns X=0 then when i press ; it gives me zero divisor error and I dont understand why,I tried posing the following 4 facts in the KB
average(0,0).
average([],0).
average(0/0,0).
average(0,0/0).
I’m not sure what you trying to achieve by writing
0/0(as a matter of fact I’m not sure what any of the facts other thanaverage([],0).are there for), but clearly dividing 0 by 0 will cause a division by zero error.So that’s your problem. Remove the occurrences of
0/0and the error will disappear.