Advertisement
sacr1ficerq

Untitled

Apr 21st, 2022
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. from itertools import product
  2.  
  3. variables_amount = 3
  4. variants = [0, 1]
  5. truth_table = list(product(variants, repeat=variables_amount))
  6.  
  7.  
  8. def f(x, y, z):
  9.     return not(x or y ) or (z == x)
  10.  
  11.  
  12.  
  13. print("x", "y", "z", " f")
  14. for row in truth_table:
  15.     result = f(*row)
  16.     if result == 0:
  17.         print(*row, f(*row))
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement