Python Interview Questions
Python Interview Questions
def factorial(n):
if n == 0: return 1
return n * factorial(n - 1)
17. What is the difference between @staticmethod, @classmethod, and instance methods?
- Instance method: Works on instance variables
- Class method: Works on class variables
- Static method: Independent of instance/class