Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Number():
- def __init__(self, value):
- self.value = value
- def eval(self):
- return int(self.value)
- class BinaryOp():
- def __init__(self, left, right):
- self.left = left
- self.right = right
- class Sum(BinaryOp):
- def eval(self):
- return self.left.eval() + self.right.eval()
- class Sub(BinaryOp):
- def eval(self):
- return self.left.eval() - self.right.eval()
- class Print():
- def __init__(self, value):
- self.value = value
- def eval(self):
- print(self.value.eval())
Add Comment
Please, Sign In to add comment