Untitled
unknown
plain_text
2 years ago
362 B
15
Indexable
class Myclass:
#static variable
__counter = 0
def __init__(self):
Myclass.__counter = Myclass.__counter + 1
self.sno = Myclass.__counter
@staticmethod
def get_counter():
return Myclass.__counter
@saticmethod
def set_counter(new):
if(new)== int:
Myclass._counter == new
else:
print("not allowed")Editor is loading...
Leave a Comment