Problem Statement
Why use @property for an attribute?
Explanation
The property decorator lets you compute or validate values while keeping a simple attribute syntax. You can add caching, type checks, or invariants.
It preserves backward compatibility if a previously simple field later needs logic.
Code Solution
SolutionRead Only
class User:
def __init__(self,name): self._name=name
@property
def name(self): return self._name.title()
@name.setter
def name(self,v): self._name=v.strip()