Код: Выделить всё
class Calculator:
def __init__(self, x, operation, y):
self.x = x
self.operation = operation
self.y = y
def math(self):
if self.operation == '+':
return self.x + self.y
if self.operation == '-':
return self.x + self.y
if self.operation == "*":
return self.x * self.y
if self.operation == '/':
return self.x / self.y
calculator_1 = Calculator(int(input('First number ')),(input('math operations (+, -, *, /, %): ')),int(input('Second number ')))
print(str(calculator_1))
Подробнее здесь: https://stackoverflow.com/questions/786 ... lculator-o