When you creating a class, you need to follow the basic principles of class realisation. You forgot about __init__
function which initialize you class, you code need to looks like:
class TestClass:
def __init__(self):
super().__init__()
def repeat(self, txt:str, num:int):
counter = 0
while counter < num:
print(txt)
counter = counter + 1
And then all will works
testing2 = TestClass()
testing2.repeat('test', 10)
#test
#test
#test
#test
#test
#test
#test
#test
#test
#test
* Be the first to Make Comment