1An object belonging to a class. e.g. if you had an Employee class, each
2individual employee would be an instance of the Employee class
1# Instance Method Example in Python
2class Student:
3
4 def __init__(self, a, b):
5 self.a = a
6 self.b = b
7
8 def avg(self):
9 return (self.a + self.b) / 2
10
11s1 = Student(10, 20)
12print( s1.avg() )
1class MyClass:
2 def method(self):
3 return 'instance method called', self
4
5 @classmethod
6 def classmethod(cls):
7 return 'class method called', cls
8
9 @staticmethod
10 def staticmethod():
11 return 'static method called'
12