title: Rule writing in Prolog
body: <p>I would like to write a rule that tells me if a person passed a subject. The minimum grade to pass is 40%. I have successfully written a predicate that tells me if the person passed, however I am confused as to how I would get it to also give me person/subject pairs. i.e. julie/history. Thank you in advance.</p>
  
  <pre><code>% studies( Person, Subject)
  % -------------------------
  studies( julie, history).
  studies( pete, chemistry).
  
  
  % marks( Person, CourseWork, Exam)
  % --------------------------------
  marks( julie, 77, 63).
  marks( pete, 55, 21).
  
  passed(Person,_Subj):-
  %get student work and exam grades
  marks(Person, Work, Exam),
  %calculate the final student grade
  Perc is Work*0.25 + Exam*0.75,
  %see if percentage is over 40%
  Perc &gt;= 40.
  </code></pre>