learning_python/intro_pytest/function.py

23 lines
373 B
Python
Raw Normal View History

2021-09-18 23:13:03 +00:00
# function.py
class Maths:
"""
A Maths class
n (int) - starting interger value
"""
def __init__(self, n: int):
self.n = n
def add(self, x: int) -> int:
self.n += x
return self.n
def subtract(self, x: int) -> int:
self.n -= x
return self.n
def __repr__(self):
return f"n is {self.n}"