Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Calculator:
- def __init__(self, brand, model):
- self._brand = brand
- self._model = model
- def __str__(self):
- return '{brand} {model} is ready to work!'.format(brand=self._brand, model=self._model)
- def add(self, first, second):
- return first + second
- def substract(self, first, second):
- return first - second
- def multiply(self, first, second):
- return first * second
- def divide(self, first, second):
- return first / second
- def integer_division(self, first, second):
- return first // second
- def modulo(self, first, second):
- return first % second
- if __name__ == "__main__":
- calc = Calculator('Casio', 2000)
- print(calc.__str__())
- print(calc.add(3, 4))
- print(calc.substract(3, 4))
- print(calc.multiply(3, 4))
- print(calc.divide(3, 4))
- print(calc.integer_division(3, 4))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement