How can I list list the names of courses having both male and female students registered for them.
CODE:
/*student(name,studnumb,age,sex)*/
student(braum,1234,22,male).
student(lux,7839,26,female).
student(ekko,1726,29,male).
student(kayle,1114,25,female).
student(darius,6654,36,male).
student(morgana,4627,20,female).
student(ashe,2563,25,female).
student(brand,9258,30,male).
findboys(GENDER):-
student(_, IS, SY, GENDER),
( var(GENDER)->true
; SY = male
),
takes(IS, IT),
teaches(TN,IT),
writeln([TN,course(IS, _)]),
fail
; true.
/*takes(studnum,modnum)*/
takes(1234,1111).
takes(7839,1111).
takes(1726,1111).
takes(1114,2345).
takes(6654,1111).
takes(4627,4588).
takes(2563,2222).
takes(9258,6534).
/*course(modnum,modname)*/
course(2222,maths).
course(2345,english).
course(1111,computerscience).
course(6654,spanish).
course(6789,antrophormism).
course(4588,teology).
Unfortunately, I can not achieve the right query or conditional to print the list the names of courses having both male and female students registered for them