Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from functools import reduce
- class Calculator:
- @staticmethod
- def add(*args):
- return sum(args)
- @staticmethod
- def multiply(*args):
- result = reduce(lambda x, y: x * y, args)
- return result
- @staticmethod
- def divide(*args):
- result = reduce(lambda x, y: x / y, args)
- return result
- @staticmethod
- def subtract(*args):
- result = reduce(lambda x, y: x - y, args)
- return result
Advertisement
Add Comment
Please, Sign In to add comment