Instance method receives self (instance). Class method receives cls (class).
1class User:2 def __init__(self, name):3 self.name = name45 # Instance method6 def greet(self):7 return f"Hello, {self.name}"89 @classmethod10 def from_string(cls, user_str):11 name = user_str.split(",")[0]12 return cls(name)1314u = User.from_string("Alice,25")15print(u.greet()) # "Hello, Alice"