Kairo.py
class Kairo:
def And(self,x,y):
return (x and y)
def Or(self, x, y):
return (x or y)
def Not(self, x):
return (not x)
def Nor(self, x, y):
return self.Not(self.Or(x, y))
def Nand(self, x, y):
return self.Not(self.And(x, y))
def Xor(self, x, y):
return self.Or(self.And(x, self.Not(y)), self.And(self.Not(x), y))
main.py
import Kairo
kairo = Kairo.Kairo()
print(kairo.Xor(False, False))
print(kairo.Xor(True, False))
print(kairo.Xor(True, True))
$ python main.py
False
True
False
Ich möchte diesmal einen halben Addierer machen
Recommended Posts