Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MyClass:
- def set(self, first, second, third):
- self.first = first
- self.second = second
- self.third = third
- def show(self):
- print("first" + str(self.first))
- print("second" + str(self.second))
- print("third" + str(self.third))
- def substract(self, first, second, third):
- return first - second - third
- def sum(self, first, second, third):
- return first + second + third
- def multiply(self, first, second, third):
- return first * second * third
- def divide(self, first, second):
- try:
- return first / second
- except ZeroDivisionError:
- print("деление на ноль")
- a = MyClass()
- a.set(1,2,3)
- print("sum: " + str(a.sum(5,8,8)))
- print("substract: " + str(a.substract(5,8,8)))
- print("multiply: " + str(a.multiply(5,8,8)))
- print("divide: " + str(a.divide(5,8)))
- print("divide: " + str(a.divide(5,0)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement