I'm trying to understand utilizing classes and their methods. I made a simple program to exit or print 'Will continue' given a word. however I keep getting a TypeError for self and through reading my books and searching online I'm still not quite sure why. the code is:
class OffSwitch(object):
def __init__(self):
self.keycheck='off'
def turnOff(self,key):
if key==self.keycheck:
SystemExit
else:
print('will continue')
switchword=input('Enter a word: ')
OffSwitch.turnOff(switchword)
and getting the error
Traceback (most recent call last):
File "E:/classpractice", line 14, in <module>
OffSwitch.turnOff(switchword)
TypeError: turnOff() takes exactly 2 arguments (1 given)