Advertisement
Guest User

Untitled

a guest
Dec 11th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | None | 0 0
  1. import base
  2.  
  3.  
  4. class ExclusivOderGatter(base.BaseGate):
  5.     def _calc_output_y(self):
  6.         if self.get_input(0) and self.get_input(1) or not self.get_input(0) and not self.get_input(1):
  7.             return False
  8.         return True
  9.  
  10.  
  11. test1 = ExclusivOderGatter(False, False)
  12. print(test1.get_output())
  13.  
  14. test2 = ExclusivOderGatter(True, False)
  15. print(test2.get_output())
  16.  
  17. test3 = ExclusivOderGatter(False, True)
  18. print(test3.get_output())
  19.  
  20. test4 = ExclusivOderGatter(True, True)
  21. print(test4.get_output())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement