document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. #!/usr/bin/python                                                                                                                                            
  2. # -*- coding: utf-8 -*-                                                                                                                                      
  3.  
  4. def AND(A, B):
  5.     return (A and B)
  6.  
  7. def OR(A, B):
  8.     return (A or B)
  9.  
  10. def NOT(A):
  11.     return (not A)
  12.  
  13. def IMP(A, B):
  14.     return (not A or B)
  15.  
  16.  
  17. def BIC(A, B):
  18.     return (IMP(A, B) and IMP(B, A))
  19.  
  20. def main():
  21.     print "Z = (¬(PvQ) v (¬Rv(R^R))"
  22.     print "P\\tQ\\tR\\t¬(PvQ)\\t¬Rv(R^R)   Z"
  23.     for P in range(2):
  24.         for Q in range(2):
  25.             for R in range(2):                                                        
  26.                 VarP = bool(P)
  27.                 VarQ = bool(Q)
  28.                 VarR = bool(R)
  29.                 VarParte1 = bool(NOT(OR(P,Q)))
  30.                 VarParte2 = bool(OR(NOT(R),(AND(R, R))))
  31.                 VarZ = bool(OR((NOT((OR(P,Q)))), (OR((NOT(R)),(AND(R,R))))))
  32.                 print "%r\\t%r\\t%r\\t%r\\t%r\\t = %r" % (VarP, VarQ, VarR, VarParte1, VarParte2, VarZ)
  33.                 #print bool(OR((NOT((OR(P,Q)))), (OR((NOT(R)),(AND(R,R))))))                                                                                      
  34. main()
');