Problem Statement
Which statement is correct about instance, class, and static methods?
Explanation
An instance method operates on object state via self. A class method operates on class state via cls. A static method is just a namespaced function.
Choosing the right kind clarifies intent and avoids accidental coupling to instance or class state.
Code Solution
SolutionRead Only
class A:
def m(self): return 'inst'
@classmethod
def c(cls): return 'class'
@staticmethod
def s(): return 'static'