Solution 1

class Calculator(object):
    def add(self, x, y):
        return x + y

    def subtract(self, x, y):
        return x - y

Calculator Method

Create a class Calculator that has two methods add and subtract which receive two numbers and perform the intended operations (returning the value). Example:

c = Calculator()
c.add(2, 5)  # 7
c.subtract(9, 6)  # 3

Test Cases

test calculator add - Run Test

def test_calculator_add():
    c = Calculator()
    assert c.add(2, 8) == 10

test calculator subtract - Run Test

def test_calculator_subtract():
    c = Calculator()
    assert c.subtract(7, 2) == 5